3 Replies Latest reply on Mar 31, 2003 9:44 AM by Adrian Brock


    Marcel Schepers Newbie


      I'm using Castor for XML binding. If I include the two Xerces jar files in my WEB-INF/lib directory JBoss/Jetty gives my a NoClassDefFoundError on a org.apache... class. The castor.jar is found and loaded. If I copy the xmlParserAPIs.jar and xercesImpl.jar to <jboss_home>/server//lib than JBoss loads the jar files. Why is it not possible to have the xerces files under WEB-INF/lib?


        • 1. Re: Xerces
          Adrian Brock Master

          Castor is probably using Class.forName()
          rather than the thread context class loader.

          You can make jboss run with xerces
          by putting the xerces jars in ${jboss.dist}/lib
          and starting jboss with
          ./run.sh -j xerces or
          run.bat -j xerces

          I've seen problems with JAXP in 1.4
          where certain methods of obtainaing the parser
          defaults to the Crimson included in jre.


          • 2. Re: Xerces
            Marcel Schepers Newbie

            Thanks for the tip. However it raises two new questions. Suppose JBoss uses Xerces. (I do not know if that is the case, but let us presume it is.) Copying 'my' Xerces jars to /lib has the potential to conflict with existing Xerces jar files, hasn't it?

            And the second question, JBoss uses Castor. For my web app to use Castor the jar file should be in WEB-INF/lib. As a result, it is very likely to be using two different versions of Castor: the JBoss included one and my app's one. That is a potential version conflict, isn't?

            What is a wise thing to do? Always use the same version?


            • 3. Re: Xerces
              Adrian Brock Master

              Using the same version is preferable.

              There are mechanisms for isolating application
              classes such as turning on the servlet classloader
              or using a seperate loader repository for an ear.

              3.2 should make some of this easier.