3 Replies Latest reply on Oct 10, 2005 10:40 AM by sjwoodman

    JBoss 3.2.3, Tomcat 4.1.29 NoClassDefFoundError

    jboss.thejavateam.com

      JBoss 3.2.3, Tomcat 4.1.29

      Have scoured numerous forums and search engines for answers and have tried numerous configuration and packaging options to no avail.

      During webapp loading my servlet's init() reads in an xml file and processes it with jdom.

      Am getting NoClassDefFoundError: org/saxpath/SaxPathException during

      org.jdom.xpath.XPath.newInstance()

      Servlet is configured to load on startup but this appears irrelevant. When set to not load on startup, will get same exception during first invocation of servlet.

      jdom and saxpath jars are in myconfig/deploy/myapp.war/WEB-INF/lib (along with all other libs necessary for myapp)

      Have tried putting the jars in a number of other seemingly appropriate locations to no avail.

      Thanks in advance,

      Tom



        • 1. Re: JBoss 3.2.3, Tomcat 4.1.29 NoClassDefFoundError
          starksm64

          There is a conflict with the version of jdom you compiled against that the jdom.jar found in jboss-3.2.3/lib/jdom.jar. Try replacing this with your version of jdom, or add a jboss-web.xml to your war to override the
          jboss version of the classes.

          <jboss-web>
          <class-loading java2ClassLoadingCompliance="false">
          <loader-repository>
          mydomain:war=mywar.war
          <loader-repository-config>
          java2ParentDelegation=false
          </loader-repository-config>
          </loader-repository>
          </class-loading>
          </jboss-web>

          • 2. Re: JBoss 3.2.3, Tomcat 4.1.29 NoClassDefFoundError
            jrinderle

            I had the same problem, but found an easy fix! If you repackage the JDOM jar to include the saxpath and jaxen classes, it will work.

            Create a temp. folder. Extract jdom.jar, saxpath.jar, jaxen-core.jar, and jaxen-jdom.jar into that folder. Now create a new jdom.jar file which contains all of the class files you just extracted. (You can exclude the META-INF folder). Replace the jdom.jar in the JBoss lib folder with the new JAR you just created. Restart JBoss and give it a try.

            • 3. Re: JBoss 3.2.3, Tomcat 4.1.29 NoClassDefFoundError
              sjwoodman

               

              "jrinderle" wrote:

              Create a temp. folder. Extract jdom.jar, saxpath.jar, jaxen-core.jar, and jaxen-jdom.jar into that folder. Now create a new jdom.jar file which contains all of the class files you just extracted. (You can exclude the META-INF folder). Replace the jdom.jar in the JBoss lib folder with the new JAR you just created. Restart JBoss and give it a try.


              This worked for me too on JBoss 3.2.3 using jdom-1.0. I packaged jaxen-core, jaxen-jdom, saxpath and jdom into one new jdom.jar. Then just copy it to /lib and overwrite the original.

              Thanks!