12 Replies Latest reply on Mar 2, 2010 5:28 AM by Shane McEneaney

    JBoss 5. RAR contained in EAR deployed after EJB Jars

    Shane McEneaney Newbie

      I have an EAR containing a number of EJB JARS and three RARs. In JBoss 4.2.3 the deployment order was RAR and the EJB JARs. This is a requirement as some of the EJBs depend on the ResourceAdapters contained in the RARs.

       

      In JBoss 5 this is no longer the case. The EJB JARS are deployed first and then subsequently the RARs. I have attempted using strict module deployment ordering but this no longer works. In addition, I have added @Depends annotations to my EJBs and MDBs but this does not work either.

       

      Any suggestions?

        • 1. Re: JBoss 5. RAR contained in EAR deployed after EJB Jars
          jaikiran pai Master

          @Depends should have worked. Does the ObjectName specified in the @Depends match with the ObjectName you see in jmx-console for this RAR? Also what exception stacktrace and logs do you see? And which exact version of JBoss AS-5?

          • 2. Re: JBoss 5. RAR contained in EAR deployed after EJB Jars
            Shane McEneaney Newbie
            Jaikiran,


            Thanks for taking the time to respond. I am using JBoss 5.0.0 EAP.


            I have tried the @Depends annotation on a number of MDBs. The MDBs are not JMS but JCA ResourceAdapter "message driven" endpoints. As I mentioned already we have a number of ResourceAdapters in our application.

            Please see sample code below.

            {code}


            @MessageDriven(name = "MyJcaEndpointMDB", messageListenerInterface = MyJcaEndpointListener.class)
            @Depends("jboss.jca:name=my-system-2.0.0.jb5.ear#my-rar-2.0.0.jb5.rar,service=RARDeployment")
            public class MyJcaEndpointMDB implements MyJcaEndpointListener {

            {code}


            I copied the ObjectName from the JMX console. The only error I see in the JBoss log is when the JBoss EJBContainer attempts to start the MyJcaEndpointMDB.


            15:37:07.170,ERROR,AbstractKernelController,main,,,, Error installing to Start: name=jboss.j2ee:ear=my-system-2.0.0.jb5.ear,jar=my-service-client-ejb-2.0.0.jb5.jar,name=MyJcaEndpointMDB,service=EJB3 state=Create
            org.jboss.deployers.spi.DeploymentException: Unable to create activation spec ra=jboss.jca:service=RARDeployment,name='my-system-2.0.0.jb5.ear#tapi-rar-2.0.0.jb5.rar' messaging-type=com.x.service.listener.MyJcaEndpointListener properties={}
                    at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
                    at org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory.createActivationSpec(JBossMessageEndpointFactory.java:326)
                    at org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory.start(JBossMessageEndpointFactory.java:207)
                    at org.jboss.ejb3.mdb.MessagingContainer.startProxies(MessagingContainer.java:224)
                    at org.jboss.ejb3.mdb.MessagingContainer.lockedStart(MessagingContainer.java:176)
                    at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:895)


            Is there any way to force JBoss to deploy my EJB Jar after the RARs as in JBoss 4.2?

            Thanks again,

            Shane
            • 3. Re: JBoss 5. RAR contained in EAR deployed after EJB Jars
              Shane McEneaney Newbie
              I should add that if I disable my MDBs and allow JBoss to start without them I can see all of the the EJBs and MDBs in my application being deployed followed by my ResourceAdapters.
              • 4. Re: JBoss 5. RAR contained in EAR deployed after EJB Jars
                Shane McEneaney Newbie

                I am bumping this question.

                 

                Is there any way to force JBoss to deploy an EJB Jar after all RARs as in JBoss 4.2.3?

                • 5. Re: JBoss 5. RAR contained in EAR deployed after EJB Jars
                  jaikiran pai Master
                  @MessageDriven(name = "MyJcaEndpointMDB", messageListenerInterface = MyJcaEndpointListener.class)
                  @Depends("jboss.jca:name=my-system-2.0.0.jb5.ear#my-rar-2.0.0.jb5.rar,service=RARDeployment")
                  public class MyJcaEndpointMDB implements MyJcaEndpointListener {

                  Are you sure that's the exact code that is being deployed? Can you please post the exact code including the import statements? Is that MDB having any @ResourceAdapter annotation? Looking at the exception stacktrace, it appears to have run into a messed up @ResourceAdapter configuration

                  • 6. Re: JBoss 5. RAR contained in EAR deployed after EJB Jars
                    Shane McEneaney Newbie

                    Hi Jaikiran,

                     

                    I am not using the @ResourceAdapter annotation. Here is the exact code I depoyed.

                     

                     

                    package com.x.service.client.mdb;

                     

                    import javax.ejb.MessageDriven;
                    import javax.ejb.TransactionAttribute;
                    import javax.ejb.TransactionAttributeType;
                    import javax.interceptor.Interceptors;

                     

                    import org.apache.log4j.Logger;
                    import org.jboss.annotation.ejb.Depends;
                    import org.springframework.beans.factory.annotation.Autowired;

                     

                    @Interceptors(org.springframework.ejb.interceptor.SpringBeanAutowiringInterceptor.class)

                    @MessageDriven(name = "CreditPricingQuoteMDB", messageListenerInterface = CreditPricingQuoteListener.class)
                    @Depends("jboss.jca:name=toms-system-2.0.0.jb5.ear#tapi-rar-2.0.0.jb5.rar,service=RARDeployment")
                    public class CreditPricingQuoteMDB implements CreditPricingQuoteListener {

                     

                     

                     

                    The jboss.xml looks like this..

                     

                    <jboss>
                       <enterprise-beans>
                          <message-driven>
                             <ejb-name>CreditPricingQuoteMDB</ejb-name>
                             <resource-adapter-name>toms-system-${project.version}.ear#tapi-rar-${project.version}.rar</resource-adapter-name>
                          </message-driven>
                       </enterprise-beans>
                    </jboss>


                     

                     

                    The Exception I get is...


                    15:37:07.133,INFO ,EJBContainer,main,,,, STARTED EJB: com.x.service.client.mdb.CreditPricingQuoteMDB ejbName: CreditPricingQuoteMDB
                    15:37:07.170,ERROR,AbstractKernelController,main,,,, Error installing to Start: name=jboss.j2ee:ear=toms-system-2.0.0.jb5.ear,jar=orders-service-client-ejb-2.0.0.jb5.jar,name=CreditPricingQuoteMDB,service=EJB3 state=Create
                    org.jboss.deployers.spi.DeploymentException: Unable to create activation spec ra=jboss.jca:service=RARDeployment,name='toms-system-2.0.0.jb5.ear#tapi-rar-2.0.0.jb5.rar' messaging-type=com.x.service.fix.api.listener.CreditPricingQuoteListener properties={}
                            at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
                            at org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory.createActivationSpec(JBossMessageEndpointFactory.java:326)
                            at org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory.start(JBossMessageEndpointFactory.java:207)
                            at org.jboss.ejb3.mdb.MessagingContainer.startProxies(MessagingContainer.java:224)
                            at org.jboss.ejb3.mdb.MessagingContainer.lockedStart(MessagingContainer.java:176)
                            at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:895)
                            at sun.reflect.GeneratedMethodAccessor328.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                            at java.lang.reflect.Method.invoke(Method.java:597)
                            at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:59)
                            at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:150)
                            at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
                            at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:243)
                            at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:47)
                            at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:111)
                            at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:72)
                            at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
                            at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:54)
                            at org.jboss.kernel.plugins.dependency.InstallsAwareAction.installAction(InstallsAwareAction.java:42)
                            at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
                            at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
                            at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
                            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)
                            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
                            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
                            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
                            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775)
                            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
                            at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:121)
                            at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer.deploy(BeanMetaDataDeployer.java:51)
                            at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
                            at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                            at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
                            at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1440)
                            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1158)
                            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1179)
                            at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1211)
                            at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1099)
                            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)
                            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
                            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
                            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
                            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:823)
                            at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
                            at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:782)
                            at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
                            at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
                            at org.jboss.system.server.profileservice.repository.ProfileDeployAction.install(ProfileDeployAction.java:70)
                            at org.jboss.system.server.profileservice.repository.AbstractProfileAction.install(AbstractProfileAction.java:53)
                            at org.jboss.system.server.profileservice.repository.AbstractProfileService.install(AbstractProfileService.java:403)
                            at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
                            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1633)
                            at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:935)
                            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1083)
                            at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:985)
                            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:775)
                            at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:540)
                            at org.jboss.system.server.profileservice.repository.AbstractProfileService.registerProfile(AbstractProfileService.java:308)
                            at org.jboss.system.server.profileservice.ProfileServiceBootstrap.start(ProfileServiceBootstrap.java:256)
                            at org.jboss.bootstrap.AbstractServerImpl.start(AbstractServerImpl.java:461)
                            at org.jboss.Main.boot(Main.java:221)
                            at org.jboss.Main$1.run(Main.java:556)
                            at java.lang.Thread.run(Thread.java:619)
                    Caused by: javax.management.InstanceNotFoundException: jboss.jca:service=RARDeployment,name='toms-system-2.0.0.jb5.ear#tapi-rar-2.0.0.jb5.rar' is not registered.
                            at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:526)
                            at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:662)
                            at org.jboss.system.server.jmx.LazyMBeanServer.invoke(LazyMBeanServer.java:283)
                            at org.jboss.ejb3.JmxClientKernelAbstraction.invoke(JmxClientKernelAbstraction.java:58)
                            at org.jboss.ejb3.mdb.inflow.JBossMessageEndpointFactory.createActivationSpec(JBossMessageEndpointFactory.java:322)

                     

                    The JMX console ..

                     

                    screenshot.PNG

                    • 7. Re: JBoss 5. RAR contained in EAR deployed after EJB Jars
                      jaikiran pai Master

                      I forgot to mention this in my previous post - Please also post the entire exception stacktrace and the console log (from the point where you application starts deploying) and the jmx-console output which shows your rar being deployed and available.

                       

                      You also might have to play with the forum editor formatting options to post all these details, so that it turns out well-formatted for easy reading.

                      • 8. Re: JBoss 5. RAR contained in EAR deployed after EJB Jars
                        Shane McEneaney Newbie

                        Hi Jaikiran,

                         

                        Thanks again for your help. For clarity, I modified my post above to include the MDB Code include the import statements, the jboss.xml, log and screen shot of JMX console highlighting JCA deployment.

                         

                        Let me know if you need anything else.

                         

                        Thanks,

                         

                        Shane

                        • 10. Re: JBoss 5. RAR contained in EAR deployed after EJB Jars
                          jaikiran pai Master
                          I think i see what's going on. It looks like we have a bug in EJB3 where we don't use the canonical form of ObjectName for invoking on the MBean. So it ends up invoking on jboss.jca:service=RARDeployment,name='toms-system-2.0.0.jb5.ear#tapi-rar-2.0.0.jb5.rar' instead of jboss.jca:name='toms-system-2.0.0.jb5.ear#tapi-rar-2.0.0.jb5.rar',service=RARDeployment

                          I don't see a workaround for this (yet). I'll try to reproduce this in EJB3 testsuite first.

                          By the way, i did not notice that you were using EAP. As Vicky pointed out, you will get far better response and a quicker solution if you just approached the support team.
                          • 11. Re: JBoss 5. RAR contained in EAR deployed after EJB Jars
                            jaikiran pai Master

                            jaikiran wrote:

                             

                            I think i see what's going on. It looks like we have a bug in EJB3 where we don't use the canonical form of ObjectName for invoking on the MBean. So it ends up invoking on jboss.jca:service=RARDeployment,name='toms-system-2.0.0.jb5.ear#tapi-rar-2.0.0.jb5.rar' instead of jboss.jca:name='toms-system-2.0.0.jb5.ear#tapi-rar-2.0.0.jb5.rar',service=RARDeployment

                            I don't see a workaround for this (yet). I'll try to reproduce this in EJB3 testsuite first.


                            Ignore my above comments (obviously, i wasn't paying too much attention while looking into this).

                             

                            The real reason why your @Depends isn't working is because you are importing the wrong annotation:

                             

                             

                            import org.jboss.annotation.ejb.Depends;

                            You should instead be using:

                             

                            import org.jboss.ejb3.annotation.Depends;
                            
                            • 12. Re: JBoss 5. RAR contained in EAR deployed after EJB Jars
                              Shane McEneaney Newbie

                              Vicky,

                               

                              My apologies for the cross post. I found the JCA forum yesterday and figured that I should have posted in there as you guys might be more familiar with writing JCA ResourceAdapters. I should have asked for my post to be moved.

                               

                              Regarding the Depends annotation and import Jaikiran. Thanks for picking that up. I'll give that a go.

                               

                              Thanks again for your help.

                               

                              Shane