2 Replies Latest reply on Nov 13, 2002 12:29 PM by jules

    Classpath/Classloader order problem

    drobert_bfm

      I've installed Jetspeed on JBoss 3.0.3 and 3.0.4 (with Jetty), and I've had to move all the libs from the WEB-INF/lib to the server's lib dir (server/XXX/lib) in order for the JBoss to load the right classes (it wouldn't even find the jars while they were under the WEB-INF/lib directory).

      This seems to point to a class loader problem. I've encountered this problem before, where JBoss/Jetty simply ignores the contents of WEB-INF/lib. In my opinion, files in WEB-INF/lib should have priority over any other libs...

        • 1. Re: Classpath/Classloader order problem
          drobert_bfm

          BTW I just checked with jboss-3.0.4_tomcat-4.1.12: same issues (One major issue is that it ignores xerces.jar, which means that jetspeed cannot initialize itself; once I put xerces.jar in the server's lib dir, that works, but other issues arise...)

          • 2. Re: Classpath/Classloader order problem

            The problem will be this :

            JetSpeed shares some common infrastructure with JBoss.
            This is loaded into e.g. server/default/lib ClassLoader
            When JetSpeed gets the Class it will get this copy.
            When this Class tries to load another JetSpeed class it looks in server/default/lib and asks it's parent CLs. It will not find it because it is in the war.

            Solutions:

            Move your whole webapp into server/default/lib - No Good
            Fix the common infrastructure to load new classes into Thread.currentThread().getContextClassLoader() (this will be the webapps) - difficult if you don't own tha infrastructure
            Try Toggling the Java2Compliance flag in jbossweb.sar/META-INF/jboss-service.xml to make Jetty use classes packaged in war in preference to those already loaded by JBoss - should work, but will probably result in serialisation between WEB and EJB tier on inter-tier calls, so slower.

            The second is the correct solution.
            There may be more.

            Any help ?

            Jules