2 Replies Latest reply on Aug 13, 2003 9:28 AM by Jon Barnett

    Dueling .jars (.jar conflict)

    tek1 Newbie

      I noticed that when I have the same .jar (castor.jar) in JBOSS_HOME/server/default/lib and in my .war file (that I deploy to JBOSS_HOME/server/default/deploy), there is a conflict.

      If I remove JBOSS_HOME/server/default/lib/castor.jar, my .war works. However, the reverse (removing castor.jar from my .war and having castor.jar in JBOSS_HOME/server/default/lib) doesn't work.

      I initially had everything in my .war, but am now migrating to using SLSB EJB's, which accesses a Castor JDO from JNDI, of which the JDO is initially loaded into JNDI via an MBean. In order to execute the MBean, I need a copy of castor.jar in JBOSS_HOME/server/default/lib. Although this will be the ultimate usage pattern, I still want to be able to run my .war as is.

      Is there a reason why my .war cannot use castor.jar in JBOSS_HOME/server/default/lib? Also, is there a way to allow my .war, containing a castor.jar, to continue working despite there also being a castor.jar in JBOSS_HOME/server/default/lib?

      Thank you.

        • 1. Same problem
          Charles W. Stanton Newbie

          We have jaxen.jar in the server/xxx/lib directory for our ejb.jar. However, we also use the JSTL in our .wars, and it has it's own jaxen.jar--different version. We end up with Class confilcts because the .wars actually end up with jaxen.jar classes that have previously been instantiated from the server/xxx/lib directory trying to interact with classes from their own /WEB-INF/lib/jaxen.jar.

          Is this a case of the Unified ClassLoader working against us? By spec, shouldn't a .war put everything in its own /WEB-INF/lib directory ahead of any other libraries?

          Any JBoss gurus out there know how to fix this?

          (JBoss 3.2.1, JDK 1.4.1)

          • 2. Re: Same problem
            Jon Barnett Master

            Java 2 classloading compliance is followed by default in the embedded servlet containers. You can turn this off by editing the relevant META-INF/jboss-service.xml for the jbossweb container SAR. Look for a line like:

            There are also copious notes in the config file explaining what this means. Essentially, without Java 2 compliance, your web app should try its own classloader first.

            People have had varied success with this with regard to their class recognition problems. Some people have also suggested bundling in an EAR and specifying the JARs explicitly in the EAR deployment.