12 Replies Latest reply: Nov 29, 2011 4:00 AM by zehao zhang RSS

    classNotFoundException in war inside ear

    Franek Jop Newbie

      I have Ear application with one war modele and one jar module inside. At the serwer startup i get exception:

       

       

      Caused by: java.lang.ClassNotFoundException: gameWeb.war.WEB-INF.classes.org.ManagerBeanTest

       

      I think that classloader searches for classes in wrong place.

       

      Server startup with only war modele goes well (without exceptions).

       

      Can u help me solve this problem?

       

      Franek

        • 1. classNotFoundException in war inside ear
          jaikiran pai Master

          Please post the entire exception stacktrace. Also please post the contents of your .jar, .war and .ear using the following command:

           

          jar -tf gameweb.war

           

          jar -tf yourjar.jar

           

          jar -tf yourear.ear

          • 2. classNotFoundException in war inside ear
            Franek Jop Newbie

            The funny thing is that when i remove my application.xml file from earFolder/META-INF everything works perfect. Only with application.xml file error arises.

             

            Here is my application.xml file content:

            ----------------------------------------

            <?xml version="1.0" encoding="UTF-8"?>

            <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" id="Application_ID" version="6">

              <display-name>gameEAR</display-name>

              <module>

                <web>

                  <web-uri>gameWEB.war</web-uri>

                  <context-root>/gameWEB</context-root>

                </web>

              </module>

              <module>

                <ejb>gameEJB.jar</ejb>

              </module>

            </application>

            ----------------------------------------

             

            The whole enterprise application is deployed as an exploded application. Here is the structure of catalogs ( (d) means directory):

             

             

            =game.ear (d)

                 gameWeb.war (d)

                      META-INF (d)

                      WEB-INF (d)

                           classes (d)

                                org (d)

                                     ManagerBeanTest.class

                                     Test.class

                           lib (d)

                           faces-config.xml

                           web.xml

                 META-INF (d)

                      application.xml

                      jboss-app.xml

                 gameEJB.jar

             

             

            gameEJB.jar is empty by now.

             

            And here is full stack trace of the exception:

            ------------------------------------------------

            15:30:15,463 ERROR [AbstractKernelController] Error installing to PostClassLoader: name=vfs:///E:/Development/jboss-6.0.0.Final/server/default/deploy/game.ear state=ClassLoader mode=Manual requiredState=PostClassLoader: org.jboss.deployers.spi.DeploymentException: Error during deploy: vfs:///E:/Development/jboss-6.0.0.Final/server/default/deploy/game.ear

                      at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49) [:2.2.0.GA]

                      at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:185) [:2.2.0.GA]

                      at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) [:2.2.0.GA]

                      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) [:2.2.0.GA]

                      at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) [:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:1983) [:2.2.0.GA]

                      at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076) [:2.2.0.GA]

                      at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679) [:2.2.0.GA]

                      at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106) [:6.0.0.Final]

                      at org.jboss.profileservice.dependency.ProfileControllerContext$DelegateDeployer.process(ProfileControllerContext.java:143) [:0.2.2]

                      at org.jboss.profileservice.dependency.ProfileDeployAction.deploy(ProfileDeployAction.java:151) [:0.2.2]

                      at org.jboss.profileservice.dependency.ProfileDeployAction.installActionInternal(ProfileDeployAction.java:94) [:0.2.2]

                      at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54) [jboss-kernel.jar:2.2.0.GA]

                      at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.GA]

                      at org.jboss.profileservice.dependency.ProfileActivationWrapper$BasicProfileActivation.start(ProfileActivationWrapper.java:190) [:0.2.2]

                      at org.jboss.profileservice.dependency.ProfileActivationWrapper.start(ProfileActivationWrapper.java:87) [:0.2.2]

                      at org.jboss.profileservice.dependency.ProfileActivationService.activateProfile(ProfileActivationService.java:215) [:0.2.2]

                      at org.jboss.profileservice.dependency.ProfileActivationService.activate(ProfileActivationService.java:159) [:0.2.2]

                      at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.activate(AbstractProfileServiceBootstrap.java:112) [:0.2.2]

                      at org.jboss.profileservice.resolver.BasicResolverFactory$ProfileResolverFacade.deploy(BasicResolverFactory.java:87) [:0.2.2]

                      at org.jboss.profileservice.bootstrap.AbstractProfileServiceBootstrap.start(AbstractProfileServiceBootstrap.java:91) [:0.2.2]

                      at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:132) [:6.0.0.Final]

                      at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.0.0.Final]

                      at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

                      at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-5]

                      at java.lang.Thread.run(Unknown Source) [:1.6.0_23]

            Caused by: java.lang.Error: Error visiting "/E:/Development/jboss-6.0.0.Final/server/default/deploy/game.ear/gameWeb.war/WEB-INF/classes/org/ManagerBeanTest.class"

                      at org.jboss.classloading.plugins.vfs.VFSResourceVisitor.visit(VFSResourceVisitor.java:268) [jboss-classloading-vfs.jar:2.2.0.GA]

                      at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:408) [jboss-vfs.jar:3.0.0.GA]

                      at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:410) [jboss-vfs.jar:3.0.0.GA]

                      at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:410) [jboss-vfs.jar:3.0.0.GA]

                      at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:410) [jboss-vfs.jar:3.0.0.GA]

                      at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:410) [jboss-vfs.jar:3.0.0.GA]

                      at org.jboss.vfs.VirtualFile.visit(VirtualFile.java:396) [jboss-vfs.jar:3.0.0.GA]

                      at org.jboss.classloading.plugins.vfs.VFSResourceVisitor.visit(VFSResourceVisitor.java:102) [jboss-classloading-vfs.jar:2.2.0.GA]

                      at org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule.visit(VFSDeploymentClassLoaderPolicyModule.java:181) [:2.2.0.GA]

                      at org.jboss.scanning.plugins.DeploymentUnitScanner.scan(DeploymentUnitScanner.java:111) [:1.0.0.GA]

                      at org.jboss.scanning.spi.helpers.UrlScanner.scan(UrlScanner.java:96) [:1.0.0.GA]

                      at org.jboss.scanning.deployers.ScanningDeployer.deploy(ScanningDeployer.java:95) [:1.0.0.GA]

                      at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.0.GA]

                      ... 43 more

            Caused by: java.lang.RuntimeException: Error visiting resource: VFSResourceContext @ gameWeb.war/WEB-INF/classes/org/ManagerBeanTest.class / BaseClassLoader@87be88{vfs:///E:/Development/jboss-6.0.0.Final/server/default/deploy/game.ear}, visitor: org.jboss.scanning.hierarchy.plugins.HierarchyTypeVisitor@18e8b5e

                      at org.jboss.scanning.plugins.visitor.IgnoreSetErrorHandler.handleError(IgnoreSetErrorHandler.java:56) [:1.0.0.GA]

                      at org.jboss.scanning.plugins.visitor.ReflectResourceVisitor.visit(ReflectResourceVisitor.java:91) [:1.0.0.GA]

                      at org.jboss.scanning.hierarchy.plugins.HierarchyIndexScanningPlugin.visit(HierarchyIndexScanningPlugin.java:91) [:1.0.0.GA]

                      at org.jboss.scanning.spi.helpers.ScanningPluginWrapper.visit(ScanningPluginWrapper.java:112) [:1.0.0.GA]

                      at org.jboss.classloading.plugins.visitor.FederatedResourceVisitor.visit(FederatedResourceVisitor.java:101) [jboss-classloading.jar:2.2.0.GA]

                      at org.jboss.classloading.plugins.vfs.VFSResourceVisitor.visit(VFSResourceVisitor.java:264) [jboss-classloading-vfs.jar:2.2.0.GA]

                      ... 55 more

            Caused by: java.lang.ClassNotFoundException: gameWeb.war.WEB-INF.classes.org.ManagerBeanTest

                      at java.net.URLClassLoader$1.run(Unknown Source) [:1.6.0_23]

                      at java.security.AccessController.doPrivileged(Native Method) [:1.6.0_23]

                      at java.net.URLClassLoader.findClass(Unknown Source) [:1.6.0_23]

                      at java.lang.ClassLoader.loadClass(Unknown Source) [:1.6.0_23]

                      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) [:1.6.0_23]

                      at java.lang.ClassLoader.loadClass(Unknown Source) [:1.6.0_23]

                      at java.lang.Class.forName0(Native Method) [:1.6.0_23]

                      at java.lang.Class.forName(Unknown Source) [:1.6.0_23]

                      at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:284) [jboss-classloader.jar:2.2.0.GA]

                      at org.jboss.classloader.spi.base.BaseClassLoaderDomain.loadClass(BaseClassLoaderDomain.java:1152) [jboss-classloader.jar:2.2.0.GA]

                      at org.jboss.classloader.spi.base.BaseClassLoader.loadClassFromDomain(BaseClassLoader.java:886) [jboss-classloader.jar:2.2.0.GA]

                      at org.jboss.classloader.spi.base.BaseClassLoader.doLoadClass(BaseClassLoader.java:505) [jboss-classloader.jar:2.2.0.GA]

                      at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:450) [jboss-classloader.jar:2.2.0.GA]

                      at java.lang.ClassLoader.loadClass(Unknown Source) [:1.6.0_23]

                      at java.lang.Class.forName0(Native Method) [:1.6.0_23]

                      at java.lang.Class.forName(Unknown Source) [:1.6.0_23]

                      at org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactoryImpl.resolveComplexTypeInfo(IntrospectionTypeInfoFactoryImpl.java:458) [jboss-reflect.jar:2.2.0.GA]

                      at org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactoryImpl.getTypeInfo(IntrospectionTypeInfoFactoryImpl.java:414) [jboss-reflect.jar:2.2.0.GA]

                      at org.jboss.reflect.plugins.introspection.IntrospectionTypeInfoFactory.getTypeInfo(IntrospectionTypeInfoFactory.java:54) [jboss-reflect.jar:2.2.0.GA]

                      at org.jboss.config.plugins.AbstractConfiguration.getTypeInfo(AbstractConfiguration.java:121) [jboss-reflect.jar:2.2.0.GA]

                      at org.jboss.kernel.plugins.config.AbstractKernelConfig.getTypeInfo(AbstractKernelConfig.java:95) [jboss-kernel.jar:2.2.0.GA]

                      at org.jboss.kernel.plugins.config.AbstractKernelConfigurator.getTypeInfo(AbstractKernelConfigurator.java:102) [jboss-kernel.jar:2.2.0.GA]

                      at org.jboss.scanning.plugins.visitor.ConfiguratorReflectProvider.getTypeInfo(ConfiguratorReflectProvider.java:47) [:1.0.0.GA]

                      at org.jboss.scanning.plugins.visitor.CachingReflectProvider.getTypeInfo(CachingReflectProvider.java:52) [:1.0.0.GA]

                      at org.jboss.scanning.plugins.visitor.ReflectResourceVisitor.getTypeInfo(ReflectResourceVisitor.java:60) [:1.0.0.GA]

                      at org.jboss.scanning.plugins.visitor.ReflectResourceVisitor.getClassInfo(ReflectResourceVisitor.java:72) [:1.0.0.GA]

                      at org.jboss.scanning.plugins.visitor.ReflectResourceVisitor.doVisit(ReflectResourceVisitor.java:107) [:1.0.0.GA]

                      at org.jboss.scanning.plugins.visitor.ReflectResourceVisitor.visit(ReflectResourceVisitor.java:86) [:1.0.0.GA]

                      ... 59 more

             

            ------------------------------------------------

            • 3. classNotFoundException in war inside ear
              Benjamin Seyinbour Expert

              Hi Franek Jop

               

               

              Means ManagerBeanTest.class could not  be found by classloaders

               

              Could we see the following:

               

              jboss-web.xml

              jboss-app.xml

               

              OR

               

              Try this  in your jboss-app.xml:

               

              <jboss-app>

              <loader-repository>game:archive=game-ear</loader-repository>

              </jboss-app>

               

              where game is the name of your EAR.

               

              Cheers!

               

              • 4. classNotFoundException in war inside ear
                Franek Jop Newbie

                Benjamin Seyinbour wrote:

                 

                 

                Hi Franek Jop

                 

                 

                Means ManagerBeanTest.class could not  be found by classloaders

                 

                 

                Yes. I know that. But classloader try to find class "gameWeb.war.WEB-INF.classes.org.ManagerBeanTest" but the class name is "org.ManagerBeanTest". I thing that here is the problem.

                 

                Here is my jboss-app.xml

                ------------------------------------------

                <?xml version="1.0" encoding="UTF-8"?>

                  <!DOCTYPE jboss-app

                    PUBLIC "-//JBoss//DTD J2EE Application 4.2//EN"

                    "http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd">

                 

                 

                <jboss-app>

                          <loader-repository>

                                game.ear:archive=game-ear

                      </loader-repository>

                </jboss-app>

                 

                ------------------------------------------

                 

                I do not have jboss-web.xml

                • 5. classNotFoundException in war inside ear
                  jaikiran pai Master

                  This does look like a bug (and probably has a workaround - I saw a similar issue where we were able to get past this). Can you please attach the application which reproduces this issue?

                  • 6. classNotFoundException in war inside ear
                    Ales Justin Master
                    But classloader try to find class "gameWeb.war.WEB-INF.classes.org.ManagerBeanTest" but the class name is "org.ManagerBeanTest". I thing that here is the problem.

                     

                    Here is my jboss-app.xml

                    ------------------------------------------

                    <?xml version="1.0" encoding="UTF-8"?>

                      <!DOCTYPE jboss-app

                        PUBLIC "-//JBoss//DTD J2EE Application 4.2//EN"

                        "http://www.jboss.org/j2ee/dtd/jboss-app_4_2.dtd">

                     

                     

                    <jboss-app>

                              <loader-repository>

                                    game.ear:archive=game-ear

                          </loader-repository>

                    </jboss-app>

                     

                    ------------------------------------------

                    Hmmm, for some reason ear' scanning thinks .war's classes are part of its classpath.

                     

                    Why do you think this jboss-app.xml is the problem?

                    Otoh, I think you don't need this file anymore, sice .ears are isolated by default -- see EARClassLoaderDeployer.

                    (unless you wanna explicitly specify the isolation domain name)

                     

                    Like Jaikiran said, it would be useful to have an example where we could reproduce this.

                    • 7. classNotFoundException in war inside ear
                      Franek Jop Newbie

                      Ales Justin wrote:

                       

                      Why do you think this jboss-app.xml is the problem?

                       

                       

                      I have do idea where is the problem. I've just post jboss-app.xml here because of Benjamin request.

                       

                      Otoh, I think you don't need this file anymore, sice .ears are isolated by default -- see EARClassLoaderDeployer.

                      (unless you wanna explicitly specify the isolation domain name)

                       

                      Like Jaikiran said, it would be useful to have an example where we could reproduce this.

                       

                      I have removed jboss-app.xml from project.

                       

                      Here is my project:

                       

                      http://www.speedyshare.com/files/27172585/application.zip

                       

                      As i said before: This application will deploy when I remove application.xml from EAR/META-INF folder.

                       

                      There are two folders in provided archive. First one: "game.ear" contains application ready to deploy. The second one contains sources.

                      • 8. classNotFoundException in war inside ear
                        Benjamin Seyinbour Expert

                        Hi Franek Jop,

                         

                        Can't find any ManagerBeanTest in your application.zip.

                         

                        BTW your 4_2.dtd needs an upgrade as you are using AS6.0

                        • 9. classNotFoundException in war inside ear
                          Franek Jop Newbie

                          Benjamin Seyinbour wrote:

                           

                          Hi Franek Jop,

                           

                          Can't find any ManagerBeanTest in your application.zip.

                           

                          Sorry about that. I've made some cleanup in project before upload. But the same error arises with RequestObserver class:

                           

                          ------------------------------------

                          java.lang.ClassNotFoundException: gameWeb.war.WEB-INF.classes.org.AandP.game.application.RequestObserver

                          -------------------------------------

                           

                           

                          BTW your 4_2.dtd needs an upgrade as you are using AS6.0

                           

                           

                          In xml file? Which one?

                          • 10. classNotFoundException in war inside ear
                            jaikiran pai Master

                            Can you first try renaming gameWeb.war to gameWEB.war? That app is failing to deploy on my *nix system because of that case sensitive issue. And after I fix that it deploys fine locally. I however haven't yet been able to reproduce the original issue that you have reported. Maybe it's a side effect of that case insensitive nature of Windows OS (on which you seem to be deploying).

                             

                            If that doesn't fix this issue, then the other problem I see in your deployment is the ClassPath entry in the META-INF/MANIFEST.MF of the .war file. It points back to the same .war. Remove that ClassPath entry and see if that works.

                            • 11. classNotFoundException in war inside ear
                              Benjamin Seyinbour Expert

                              In xml file? Which one?

                               

                              No, simple change the the version number e.g:

                               

                              <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">

                               

                              Or remove it from the jboss-web.xml -- you can do without.

                               

                               

                              Anyway back to the small matter of your ClassNotFoundException.

                               

                              Forget the jboss-web.xml; clear the table and just do the following:

                               

                              gameEAR.ear

                              |+ META-INF

                                  |+ application.xml

                                  |+ jboss-app.xml

                               

                              <!DOCTYPE jboss-app  PUBLIC "-//JBoss//DTD J2EE Application 5.0//EN"  "http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd">

                              <jboss-app>

                              <loader-repository>gameEAR:archive=gameEAR.ear

                              </loader-repository>

                              </jboss-app>

                               

                               

                               

                              BREAKING NEWS!!!

                               

                              |+ gameWEB.war

                                  |+ WEB-INF

                                  |--|+ web.xml

                                  |+ META-INF

                                  |--|+ MANIFEST.MF

                               

                              Manifest-Version: 1.0

                              Class-Path: gameWEB.war

                               

                              jaikiran pai could be on a solution here.

                               

                               

                              • 12. Re: classNotFoundException in war inside ear
                                zehao zhang Newbie

                                Hi Franek Jop,

                                 

                                Do you resovled this problem? I think I faced the same problem.