1 Reply Latest reply on Oct 21, 2002 9:04 PM by joelvogt

    Very strange NoClassDefFoundError

    brienv

      We ran into a very strange problem while trying to deploy our WAR (as a .war directory) where the server seems to be ignoring certain JAR's in the WAR lib directory. NoClassDefFoundError's are generated for the XMLSerializer class, among others.

      After much searching on these forums, I ran across a thread regarding a similar problem at
      http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ . Someone there suggested moving the Xerces up to the server/deploy/lib directory. Noone in the thread was able to figure out why it was necessary, though. Doing this got rid of the XMLSerializer error but then it couldn't find my JDBC driver (in Sprinta2000.jar). I then moved the Sprinta2000.jar to the server/deploy/lib directory and my app runs (this was after a bunch of additional trial-and-error). The other JAR files seem to work fine in the i.war/WEB-INF/lib/ directory, though.

      Does anyone have any information as to what the problem is? I would rather not have WAR-specific jar files polluting the server lib directory, if possible. After many hours we're now at least able to get our application running but we'd like to know what caused the problem in the first place.

      Any help greatly appreciated,
      Brien Voorhees

      Here are more details in case they're helpful:

      OS: Windows XP Professional
      JBOSS: 3.03 with JBossWeb
      JDK: 1.4.1

      Directory structure :

      C:\JBOSS-3.0.3\SERVER\DEFAULT\DEPLOY\I.WAR
      | about-the-company.html (and various other html files)
      |
      +---images
      | background.gif, etc.
      \---WEB-INF
      | jboss-web.xml
      | web.xml
      |
      +---classes
      | \---com
      | \---inteleport
      | +--- (various class files)
      |
      \---lib
      ccc_ssl.jar
      commons-lang-1.0.jar
      jakarta-regexp-1.1.jar
      jta1.0.1.jar
      jtds-0.3.2.jar
      ognl-2.1.3.jar
      oscore-2.0.1.jar
      Sprinta2000.jar
      xerces-J_1.4.0.jar

      --------------------------------------------------------
      web.xml contents :

      <?xml version="1.0"?>


      <web-app>


      <servlet-name>OrderServlet</servlet-name>
      <servlet-class>com.inteleport.web.OrderServlet</servlet-class>
      <load-on-startup>0</load-on-startup>


      <servlet-mapping>
      <servlet-name>OrderServlet</servlet-name>
      <url-pattern>/OrderServlet</url-pattern>
      </servlet-mapping>

      <servlet-mapping>
      <servlet-name>JSP</servlet-name>
      <url-pattern>*.html</url-pattern>
      </servlet-mapping>

      </web-app>


      --------------------------------------------------------
      jboss-web.xml contents :
      <jboss-web>
      <virtual-host>www.testinteleport.com</virtual-host>
      <context-root>/</context-root>
      </jboss-web>

        • 1. Re: Very strange NoClassDefFoundError
          joelvogt

          Xml parsers are a bit notorious for causing conflicts. As you would realise jboss needs one to run, so if you provide another in the classpath it does cause problems. Moving it up basically tells jboss to 'use this one' rather than making it confused. (I can give an even vauger answer if you want). With your jdbc drivers, generally jboss needs to access them at a container level so it can provide the connection pooling etc which is external to your war file. These are generally a good idea to have available to all apps anyway, so if they use the same db they don't end up using different drivers and causing wierd bugs.