7 Replies Latest reply on May 9, 2007 12:49 PM by jbossfann

    jboss library loading sequence

    jbossfann

      Hi guys,

      I am new to JBoss 4.0.2, and I am trying to find some info on how JBoss loads library jars.

      Let's say I have 2 web applications in 2 WAR files that both need to use struts.jar library. It seems if I put it into .../server/default/lib directory it does not work and it only works when I put it inside .WAR archives in WEB-INF/lib directory.

      So, how does JBoss handle Class loading and in what sequence from WEB-INF/lib, .../server/default/lib and other applciation lib directories?

      Is there any way to see through web-console what libs are currently loaded

      Thanks a lot

        • 1. Re: jboss library loading sequence
          ankurkkapadia

          your answer lies in the post below,

          however its a bit of a mess

          http://wiki.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration

          • 2. Re: jboss library loading sequence
            jbossfann

            I went trrough this before but I still have a question that I can't answer.

            If I only put libraries into .../server/default/lib shouldn't an application always be able to see it.

            Somehow I have to put struts.jar into both .../server/default/lib and WEB-INF/lib (part of war archive) otherwise I am getting different exceptions... (tld or classes not found...)

            I will really appreciate a fe tips.

            Thanks!

            • 3. Re: jboss library loading sequence
              weston.price

              Typicall you don't have to do this. WARS use an isolated classloader by default which should allow you to simply wrap things up in your WEB-INF/lib directory and you should be all set. But I think the struts.jar has some weirdness associated with the deployment. Again, the Web forum is probably a better place to get better coverage simply because users in the forum have probably gone through this a few times.

              • 4. Re: jboss library loading sequence
                weston.price

                Note, I apologize for posting things you probably have already read. It took me a while to remember that Struts may have different dependencies that a typical utility jar.

                • 5. Re: jboss library loading sequence
                  jbossfann

                  Thanks for your help. I will try the web forum as well.

                  I still have a question you may be able to help me answer, though.

                  If I do drop some libraries into .../server/default/lib would I need to put something in Class_Path attribute into a manifest file of my war or ear application to be able to see them from within ear or war application classes?

                  I just thought that an application, ear or war should be able to see the libs in the server directory, .../server/default/lib, by default.


                  • 6. Re: jboss library loading sequence
                    weston.price

                    Right, server/lib takes precendence in the CL order. Typically most Classloading errors in JBoss occur when classes from multiple classloading domains conflict. A good example of this is having classes in server/lib and having them packaged in your archive as well.

                    • 7. Re: jboss library loading sequence
                      jbossfann

                      Thanks a lot for your help!!