2 Replies Latest reply on Aug 21, 2008 8:47 AM by Noel Aguilar

    NoClassDefFoundError and ClassNotFoundException errors durin

    Noel Aguilar Newbie

      I have an application that I'm trying to deploy to JBossAS 4.2.3, but can't because I keep getting both java.lang.NoClassDefFoundError and java.lang.ClassNotFoundException. Please note that this application was previously deployed on JBoss 3.2.8 without any problems.

      My application is organized as follows:

      The EAR file contains the EJB's and some utility classes that are packaged in a jar file (i.e. utility.jar) under the \lib folder.

      My WAR file is being deployed outside of the EAR file, but it references some of the utility classes found in the utility.jar file that is packaged in the EAR and it does not contain the utility.jar in its WEB-INF\lib folder.

      I've read the JBoss Wiki on the ClassLoaderConfiguration and it seems that JBoss 4.2.3 has the concept a scoped class loader while JBoss 3.2.8 had a shared class loader. I looked ear-deployer.xml file and the isolation levels seem to be turned off, which I assume means that its using a shared class loader. Here is what I have in my JBoss 4.2.3 ear-deployer.xml:


      I also checked all my jboss-service.xml and jboss-web.xml file and I had no references to the <loader-repository> tags, except in the console-mgr-.sar\META-INF\jboss-service.xml file.

      Is there any other way to make my server instance use a shared class loader or is there anything else I can check or change to resolve this?

      Any help is greatly appreciated.

        • 1. Re: NoClassDefFoundError and ClassNotFoundException errors d
          Noel Aguilar Newbie

          Since the post isn't showing the XML tags for the ear-deployer.xml, Here are the attribute settings:

          attribute name="Isolated" -> false
          attribute name="CallByValue" -> false
          attribute name="EnablelibDirectoryByDefault" -> true

          • 2. Re: NoClassDefFoundError and ClassNotFoundException errors d
            Noel Aguilar Newbie

            Issue Resolved. The reason why I was getting this error was not not because isolation was turned on, it was because the servlets in my WAR file were loading on startup and they referenced classes that existed in the EAR file. Since the WAR and EAR were deployed seperately, the WAR was being loaded before the EAR file and therefore the classes were not found.

            The solution was to fix the deployment order so that the EAR file was loaded before the WAR file and this was done by updating the \conf\xmdesc\org.jboss.deployment.MainDeployer-xmbean.xml file.

            The following is the line I changed:

            <value value="250:.rar,300:-ds.xml,400:.jar,500:.ear,550:.jse,650:.war,800:.bsh"/>

            As you can see, ear now comes before war.