4 Replies Latest reply on Mar 17, 2011 3:09 PM by Thomas Püttmann

    JBoss AS 5.1.0 classloading problem after deploying multiple ears

    Thomas Püttmann Newbie

      Hello!

       

      I migrate my J2EE applications from JBoss AS 4 to JBoss AS 5.Now I use EJB3.

      After I deployed my apllications one by one, everything works fine.

       

      For development I use a ANT script which build all applications and copies all ears simultanious to the deploy folder of jboss for autodeploying.

      In this case a curious error occured.

       

      In some beans I doo something like that:

       

      public Data[] getSomeData()

      {

                Data[] data = getSomeDataFromDB();

                Array.sort(data, new Comparator()

                {

       

                     public int compare(Data o1, Datao2)

                     {

                          ....

                          return 1;

                     }

       

                });

                return data;

      }

       

      Here I get a NoClassDefFoundException at the point of sorting the Array. The classloader could not load the inner class (Comparator). All other methods which does not use inner classes works fine.

      So I redeploy only the affected application and then everything works fine.

       

      I could readjust this strange behaviour anytime by copying all apllications in a short time interval to the deploy folder. (there are no errors in the server logs while deploying)

       

      Additinal Info :

      - I use 'default'-server (no changes made in configuration)

      - there are no dependencies between the applications defined.

       


      Stacktrace send to client:

       

      Caused by: java.lang.ClassNotFoundException: com.puettmann.articleadmin.server.TestProtocolDefBean$1 from BaseClassLoader@13e4b9a{VFSClassLoaderPolicy@d57c83{name=vfszip:/D:/jboss/jboss-5.1.0.GA/server/default/deploy/deploy_cowo/articleadmin.ear/ domain=ClassLoaderDomain@f05870{name=com.puettmann:archive=articleadmin.ear parentPolicy=AFTER_BUT_JAVA_BEFORE parent=ClassLoaderDomain@19e733e{DefaultDomain}} roots=[MemoryContextHandler@31554786[path= context=vfsmemory://a1139-ucy21p-glak7qlg-1-glakg99a-cs real=vfsmemory://a1139-ucy21p-glak7qlg-1-glakg99a-cs], DelegatingHandler@13712578[path=deploy_cowo/articleadmin.ear context=file:/D:/jboss/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/jboss/jboss-5.1.0.GA/server/default/deploy/deploy_cowo/articleadmin.ear], DelegatingHandler@13498929[path=deploy_cowo/articleadmin.ear/PuettmannBaseServer.jar context=file:/D:/jboss/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/jboss/jboss-5.1.0.GA/server/default/deploy/deploy_cowo/articleadmin.ear/PuettmannBaseServer.jar], DelegatingHandler@14999237[path=deploy_cowo/articleadmin.ear/addressadmin_base.jar context=file:/D:/jboss/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/jboss/jboss-5.1.0.GA/server/default/deploy/deploy_cowo/articleadmin.ear/addressadmin_base.jar], DelegatingHandler@31292383[path=deploy_cowo/articleadmin.ear/articleadminEJB.jar context=file:/D:/jboss/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/jboss/jboss-5.1.0.GA/server/default/deploy/deploy_cowo/articleadmin.ear/articleadminEJB.jar], DelegatingHandler@32480407[path=deploy_cowo/articleadmin.ear/articleadmin_base.jar context=file:/D:/jboss/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/jboss/jboss-5.1.0.GA/server/default/deploy/deploy_cowo/articleadmin.ear/articleadmin_base.jar], DelegatingHandler@1151747[path=deploy_cowo/articleadmin.ear/cw_base.jar context=file:/D:/jboss/jboss-5.1.0.GA/server/default/deploy/ real=file:/D:/jboss/jboss-5.1.0.GA/server/default/deploy/deploy_cowo/articleadmin.ear/cw_base.jar]]  delegates=null exported=[com.puettmann.addressadmin.bobj.valueobj, com.commitwork.masterdata.server, com.commitwork.base.server.sso, com.puettmann.addressadmin, com.commitwork.base.jasper, com.commitwork.base.location.server, com.commitwork.tsmp, com.commitwork.base.server.jdbc.util, config, com.commitwork.base.server.jdbc, com.puettmann.base.util, com.commitwork.masterdata.bobj, com.puettmann.articleadmin.server, com.puettmann.articleadmin.util, com.puettmann.articleadmin.bobj, com.commitwork.base.bobj, com.commitwork.base.server, com.commitwork.ldap.server, com.commitwork.base.util, com.puettmann.articleadmin.interfaces, com.puettmann.articleadmin, com.puettmann.addressadmin.util.constant, META-INF, com.puettmann.articleadmin.util.constant, com.commitwork.base.authorisation.server, com.commitwork.base.server.util, com.puettmann.articleadmin.server.jdbc.generated, com.commitwork.base.location.server.jdbc, com.puettmann.addressadmin.server.jdbc, com.commitwork.base.transport, com.puettmann.articleadmin.server.jdbc, com.puettmann.articleadmin.bobj.valueobj, com.puettmann.addressadmin.server.jdbc.generated, com.puettmann.addressadmin.bobj] <IMPORT-ALL>NON_EMPTY}}

          at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448)

          at java.lang.ClassLoader.loadClass(ClassLoader.java:248)

          at com.puettmann.articleadmin.server.TestProtocolDefBean.readTestProtocolDef(TestProtocolDefBean.java:76)

          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111)

          at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69)

          at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73)

          at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59)

          at sun.reflect.GeneratedMethodAccessor299.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

          at java.lang.reflect.Method.invoke(Method.java:597)

          at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72)

          at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_21177041.invoke(InvocationContextInterceptor_z_fillMethod_21177041.java)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88)

          at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_21177041.invoke(InvocationContextInterceptor_z_setup_21177041.java)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.tx.StatelessBMTInterceptor.handleInvocation(StatelessBMTInterceptor.java:106)

          at org.jboss.ejb3.tx.BMTInterceptor.invoke(BMTInterceptor.java:55)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:421)

          at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53)

          at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91)

          at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)

          at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:891)

          at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:744)

          at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:697)

          at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:524)

          at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:232)

          at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:211)

          at org.jboss.remoting.Client.invoke(Client.java:1724)

          at org.jboss.remoting.Client.invoke(Client.java:629)

          at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)

          at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)

          at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62)

          at $Proxy3.invoke(Unknown Source)

          at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:207)

          at org.jboss.ejb3.proxy.impl.handler.session.SessionProxyInvocationHandlerBase.invoke(SessionProxyInvocationHandlerBase.java:164)

       

       

      Any ideas ?

       

      Tom

        • 1. JBoss AS 5.1.0 classloading problem after deploying multiple ears
          Mark Paluch Master

          Hi Tom,

          for some reasons expanded EAR/WAR-Deployments behavior different in class loading things. Have you tried deploying/redeploying an zipped EAR-File in Dev-Environment? It looks like a Bug within JBoss' EARDeployer.

           

          Best regards,

          Mark

          • 2. JBoss AS 5.1.0 classloading problem after deploying multiple ears
            Thomas Püttmann Newbie

            Hi Mark,

             

            I think I already use zipped EAR-Files.

            Overall I have four EAR - Files with the following structure:

             

            ear

            |-META-INF

            |      |- application.xml

            |      |- jboss-app.xml    

            |

            |-jar-File1 (ejb module)

            |-jar-File2 (java module)

            ....

             

            The classloading problem only occures when I redploy all ears simultanious by copy them into deploy folder.

             

            At the moment I have found a workaround, that works for me;

            My ant scipt deletes all ears before copy them, so Jboss first undeploy the apps before deploying them again. not fine but works

             

            Regards,

            Tom

            • 3. JBoss AS 5.1.0 classloading problem after deploying multiple ears
              Mark Paluch Master

              Hi Tom,

              your EAR-Structure is fine, but I wonder why JBoss does not undeploy the EAR-Files when they got overwritten. Does JBoss print anything on the console about undeploying/redeploying your EJB's when the old EAR File gets overwritten?

               

              Best regards,

              Mark

              • 4. Re: JBoss AS 5.1.0 classloading problem after deploying multiple ears
                Thomas Püttmann Newbie

                Hey Mark,

                 

                of course does JBoss undeploy and deploy the EAR-Files when they got overwritten. Console output looks fine.

                But in this case the NoClassDefFoundExecption occures.

                 

                In summary:

                Delete EAR-Files and wait till JBoss undeploy them und then copy all EAR -Files for deployment..... - works!! .

                But when I do this in one step, by overwriting the EAR-Files , I run into the error described in my first post. That means that I am able to call the bean from client, but when accessing inner classes -> NoClassDefFound (Note: Console output after deploying is OK!!!)

                In this case I overwrite only the affected EAR-File for redeployement and then... MAGIC,MAGIC... all works fine.

                 

                I think this is a very strange timing problem of the JBoss classloader...

                .... and I want to understand it :-)

                 

                Regards,

                Tom