1 Reply Latest reply on Feb 7, 2012 6:34 AM by Tor J. Johannessen

    Reference interface in another ear

    Tor J. Johannessen Newbie

      Hi!

       

      I have a class loading issue when trying to deploy to JBoss 6. It worked perfectly well in JBoss 5.

       

      I have two ear files. An interface is defined in the first loaded ear and a class (a MDB) in the second loaded ear references that interface, When starting JBoss I get a NoClassDefFoundError when the second ear file is deployed.

       

      The application usees default ear isolation. I have started JBoss with -verbose:class, to be sure the interface is loaded first

       

      Any ideas? Are there any differences between version 5 and 6 that I have missed?

       

       

      13:20:31,243 ERROR [AbstractKernelController] Error installing to Real: name=vfs:///C:/jboss-6.1.0.Final/server/default/deploy/faktura.ear state=PreReal mode=Manual requiredState=Real: org.jboss.deployers.spi.DeploymentException: Error deploying fakturamdb.jar: interfaces/faktura/FakturaMessage
              at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:194) [:6.1.0.Final]
              at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:60) [:6.1.0.Final]
              at org.jboss.deployers.vfs.spi.deployer.AbstractSimpleVFSRealDeployer.deploy(AbstractSimpleVFSRealDeployer.java:56) [:2.2.2.GA]
              at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:63) [:2.2.2.GA]
              at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55) [:2.2.2.GA]
              at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179) [:2.2.2.GA]
              at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1832) [:2.2.2.GA]
              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1550) [:2.2.2.GA]
              at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1603) [:2.2.2.GA]
              at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1491) [:2.2.2.GA]
              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.deployers.plugins.deployers.DeployersImpl.change(DeployersImpl.java:1983) [:2.2.2.GA]
              at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:1076) [:2.2.2.GA]
              at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:679) [:2.2.2.GA]
              at org.jboss.system.server.profileservice.deployers.MainDeployerPlugin.process(MainDeployerPlugin.java:106) [:6.1.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.SP2]
              at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42) [jboss-kernel.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:379) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:2044) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:1083) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.executeOrIncrementStateDirectly(AbstractController.java:1322) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1246) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1139) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:939) [jboss-dependency.jar:2.2.0.SP2]
              at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:654) [jboss-dependency.jar:2.2.0.SP2]
              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.1.0.Final]
              at org.jboss.system.server.profileservice.bootstrap.BasicProfileServiceBootstrap.start(BasicProfileServiceBootstrap.java:56) [:6.1.0.Final]
              at org.jboss.bootstrap.impl.base.server.AbstractServer.startBootstraps(AbstractServer.java:827) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-6]
              at org.jboss.bootstrap.impl.base.server.AbstractServer$StartServerTask.run(AbstractServer.java:417) [jboss-bootstrap-impl-base.jar:2.1.0-alpha-6]
              at java.lang.Thread.run(Thread.java:662) [:1.6.0_30]
      Caused by: java.lang.NoClassDefFoundError: interfaces/faktura/FakturaMessage
              at java.lang.Class.getDeclaredMethods0(Native Method) [:1.6.0_30]
              at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) [:1.6.0_30]
              at java.lang.Class.getDeclaredMethods(Class.java:1791) [:1.6.0_30]
              at org.jboss.ejb3.interceptors.lang.SecurityActions$1.run(SecurityActions.java:43) [:1.1.3]
              at org.jboss.ejb3.interceptors.lang.SecurityActions$1.run(SecurityActions.java:40) [:1.1.3]
              at java.security.AccessController.doPrivileged(Native Method) [:1.6.0_30]
              at org.jboss.ejb3.interceptors.lang.SecurityActions.getDeclaredMethods(SecurityActions.java:39) [:1.1.3]
              at org.jboss.ejb3.interceptors.lang.ClassHelper.populateAllMethods(ClassHelper.java:219) [:1.1.3]
              at org.jboss.ejb3.interceptors.lang.ClassHelper.getAllMethods(ClassHelper.java:88) [:1.1.3]
              at org.jboss.ejb3.interceptors.metadata.BeanInterceptorMetaDataBridge.initialise(BeanInterceptorMetaDataBridge.java:246) [:1.1.3]
              at org.jboss.ejb3.interceptors.metadata.BeanInterceptorMetaDataBridge.<init>(BeanInterceptorMetaDataBridge.java:138) [:1.1.3]
              at org.jboss.ejb3.interceptors.metadata.AdditiveBeanInterceptorMetaDataBridge.<init>(AdditiveBeanInterceptorMetaDataBridge.java:48) [:1.1.3]
              at org.jboss.ejb3.EJBContainer.initMetaDataBasedAnnotationRepository(EJBContainer.java:1928) [:1.7.21]
              at org.jboss.ejb3.EJBContainer.getMetaDataBasedAnnotationRepository(EJBContainer.java:1898) [:1.7.21]
              at org.jboss.ejb3.aop.BeanContainer.initialize(BeanContainer.java:191) [:1.7.21]
              at org.jboss.ejb3.EJBContainer.<init>(EJBContainer.java:301) [:1.7.21]
              at org.jboss.ejb3.TimerServiceContainer.<init>(TimerServiceContainer.java:86) [:1.7.21]
              at org.jboss.ejb3.mdb.MessagingContainer.<init>(MessagingContainer.java:91) [:1.7.21]
              at org.jboss.ejb3.mdb.MDB.<init>(MDB.java:63) [:1.7.21]
              at org.jboss.ejb3.Ejb3AnnotationHandler.getMDB(Ejb3AnnotationHandler.java:358) [:1.7.21]
              at org.jboss.ejb3.Ejb3AnnotationHandler.getContainers(Ejb3AnnotationHandler.java:223) [:1.7.21]
              at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:759) [:1.7.21]
              at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:710) [:1.7.21]
              at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:692) [:1.7.21]
              at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:655) [:1.7.21]
              at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:544) [:1.7.21]
              at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:177) [:6.1.0.Final]
              ... 49 more
      Caused by: java.lang.ClassNotFoundException: interfaces.faktura.FakturaMessage from BaseClassLoader@60413157{vfs:///C:/jboss-6.1.0.Final/server/default/deploy/faktura.ear}
              at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:480) [jboss-classloader.jar:2.2.1.GA]
              at java.lang.ClassLoader.loadClass(ClassLoader.java:247) [:1.6.0_30]
              ... 76 more
      
        • 1. Re: Reference interface in another ear
          Tor J. Johannessen Newbie

          The file server\default\deployers\ear-deployer-jboss-beans.xml contains the following section:

           

          <bean name="EARClassLoaderDeployer" class="org.jboss.deployment.EarClassLoaderDeployer">
             <!-- A flag indicating if ear deployments should have their own scoped class loader to isolate their classes from other deployments.   -->
             <property name="isolated">true</property>
          </bean>
          

           

            I.e., the ear-files are isolated by default. So there are three options:

          1. Turn off isolation
          2. Package the necessarry files in each ear file
          3. Put the common files in the lib directory

           

          I chose option 2...