4 Replies Latest reply on Apr 22, 2011 7:05 PM by jcl2011

    force jbossclassloader to use server/lib first

    jcl2011

      I'm isolating the ear files in my jboss server in the jboss-app.xml file. However this is forcing the classloader to always use the jar files packaged in the .ear first. I want to change the order so that it uses the jar files in server/lib first, and only if that fails, use the jar file in the .ear file. How can I go about doing this?

        • 1. force jbossclassloader to use server/lib first
          alesj

          How do you see that it uses .ear first?

          Since isolation != hierarchy, hence it should still go to server/lib first.

          • 2. force jbossclassloader to use server/lib first
            jcl2011

            I have different versions of the same jar file in the .ear package and in server/lib. It works fine without isolation But I get a ClassCastException the moment I introduce it. That's why I think isolation is causing the issue.

            • 3. force jbossclassloader to use server/lib first
              alesj

              I would guess you have the dup jar in your .war inside .ear?

              Hence child-first=true kicks in due to servlet spec CL rules.

              • 4. force jbossclassloader to use server/lib first
                jcl2011

                no, the duplicate jar file is not in the .war of the .ear. It's just in the root of the .ear.  The problem jar is antlr.

                 

                - In the .ear root, i have antlr-2.7.7.jar

                - In jboss's server/myServerName/lib I have antlr-2.7.6.jar

                 

                Currently I are using the following jboss-app.xml to try to resolve my issue, but I continue to get the ClassCastException which makes me believe it is still pulling the antlr version from the ear file, not the server/lib as i expect.

                 

                <jboss-app>

                  <loader-repository>

                    earName.ear:archive=earName.ear

                    <loader-repository-config>java2ParentDelegation=true</loader-repository-config>

                  </loader-repository>

                </jboss-app>

                 

                Thanks a lot for your help!