8 Replies Latest reply on Dec 15, 2009 7:32 AM by alesj

    Deployment order within rar file

    ramses

      I have a sar file within a rar file.

       

      smsconnector.rar

      META-INF/MANIFEST.MF
      META-INF/ra.xml
      smsjmx.sar

      META-INF/MANIFEST.MF
      META-INF/jboss-service.xml

      smsjmx-server.jar

      smsconnector-server.jar
      smslib.jar

       

      during start() of the RessourceAdapter the MBean of the sar file is used (addNotificationListener).

       

      It worked fine with JBoss 4, but with JBoss 5.1.0.GA i think the deployment order has changed. The MBean is created after the ResourceAdapter is started.

       

      I tried following:

       

      I added a aliases.txt (content "mysmsjmx") in the META-INF of the sar file and a jboss-dependency.xml (content "

      <dependency xmlns="urn:jboss:dependency:1.0">
        <item>mysmsjmx</item>
      </dependency>

      ") in the META-INF of the rar file. But this does not work.

       

      How can i change the deployment order within this rar file?


      br ramses

        • 1. Re: Deployment order within rar file
          alesj

          I added a aliases.txt (content "mysmsjmx") in the META-INF of the sar file and a jboss-dependency.xml (content "

          <dependency xmlns="urn:jboss:dependency:1.0">
            <item>mysmsjmx</item>
          </dependency>

          ") in the META-INF of the rar file. But this does not work.

           

          This only works for separate deployments.

          As we can only control top level deployment.

          How can i change the deployment order within this rar file?

          Who creates and starts ResourceAdapter (RA)?

          If RA is mbean or bean, all you need to do is to create proper explicit dependency.

           

          Or you can split the rar and sar, and use your existing jb-dep.xml solution.

          • 2. Re: Deployment order within rar file
            ramses
            Who creates and starts ResourceAdapter (RA)?

            If RA is mbean or bean, all you need to do is to create proper explicit dependency.

            RA is created and started during processing of the ra.xml file (JCA connector specification). This is no MBean or bean, and as i know there is no dependency specification possible.

            Or you can split the rar and sar, and use your existing jb-dep.xml solution.

            I tried this, but it do not work, too. I extracted the sar file from the war with the dependency extension descript above.

            br ramses
            • 3. Re: Deployment order within rar file
              alesj
              I tried this, but it do not work, too. I extracted the sar file from the war with the dependency extension descript above.

              You mean rar not war?

               

              Hmmm, that should work.

              And you don't even need alias.txt, as you can directly depend on the MBean.

              Just make sure you use canonical form of the mbean object name.

               

              Can you debug?

              Or how do you know it didn't work? I would at least expect some "complaint" from potential unresolved dependency.

              • 4. Re: Deployment order within rar file
                ramses

                You mean rar not war?

                Yes i mean rar (JCA Connector)

                 

                Just make sure you use canonical form of the mbean object name.

                I changed the META-INF\jboss-dependency.xml in the rar file as follows:

                <dependency xmlns="urn:jboss:dependency:1.0">
                <item>sx.resource.sms:service=SMSCenterManager</item>
                </dependency>
                

                 

                Or how do you know it didn't work?

                The start method of the ressource adapter is called, although the sar file is not deployed and the MBean is not available at the jmx console.

                 


                Here the log entries of the deployment:

                17:24:27,344 DEBUG [DeployersImpl] Deploying vfszip:/D:/jboss/server/sx/farm_ra/smsconnector.rar/
                17:24:27,797 DEBUG [InMemoryClassesDeployer] Dynamic class root for vfszip:/D:/jboss/server/sx/farm_ra/smsconnector.rar/ is vfsmemory://4e6a5k1v-wrhss6-g3717d3q-1-g37gg905-f7
                17:24:27,875 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@19121510{vfszip:/D:/jboss/server/sx/farm_ra/smsconnector.rar/smsconnector-server.jar/}
                17:24:27,875 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@19121510{vfszip:/D:/jboss/server/sx/farm_ra/smsconnector.rar/smsconnector-server.jar/}
                17:24:27,875 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@19121510{vfszip:/D:/jboss/server/sx/farm_ra/smsconnector.rar/smsconnector-server.jar/}
                17:24:28,125 INFO [EjbDeployer] installing bean: ejb/smsconnector-server.jar#SMSRouter,uid12699078
                17:24:28,125 INFO [EjbDeployer] with dependencies:
                17:24:28,125 INFO [EjbDeployer] and supplies:
                17:24:28,125 INFO [EjbDeployer] jndi:sx/resource/SMSRouterLocal
                17:24:28,125 INFO [EjbDeployer] jndi:sx/resource/SMSRouter
                17:24:28,172 DEBUG [AbstractDeploymentContext] Added component ejb/smsconnector-server.jar#SMSRouter,uid12699078 to vfszip:/D:/jboss/server/sx/farm_ra/smsconnector.rar/smsconnector-server.jar/
                17:24:28,703 DEBUG [AbstractDeploymentContext] Added component jboss.jca:name='smsconnector.rar',service=RARDeployment to vfszip:/D:/jboss/server/sx/farm_ra/smsconnector.rar/
                17:24:28,703 DEBUG [AbstractDeploymentContext] Added component jboss.j2ee:module="smsconnector-server.jar",service=EjbModule to vfszip:/D:/jboss/server/sx/farm_ra/smsconnector.rar/smsconnector-server.jar/
                17:24:28,703 DEBUG [AbstractDeploymentContext] Added component jboss.jacc:id="vfszip:/D:/jboss/server/sx/farm_ra/smsconnector.rar/smsconnector-server.jar/",parent="smsconnector.rar",service=jacc to vfszip:/D:/jboss/server/sx/farm_ra/smsconnector.rar/smsconnector-server.jar/
                17:24:28,703 INFO [RARDeployment] Required license terms exist, view vfszip:/D:/jboss/server/sx/farm_ra/smsconnector.rar/META-INF/ra.xml
                17:24:28,781 DEBUG [SMSResourceAdapter] SMSResourceAdapter() - start
                17:24:28,797 DEBUG [SMSResourceAdapter] SMSResourceAdapter() - end
                17:25:27,108 DEBUG [SMSResourceAdapter] start(BootstrapContext) - start
                

                • 5. Re: Deployment order within rar file
                  alesj

                  My guess would be you're missing whenRequired attribute in item.

                  It should be the state/deployment stage in which the RA is started.

                  By default we're setting DESCRIBED, which should be soon enough though ...

                   

                  I guess it's some deployer that starts the RA? Or who does?

                  • 6. Re: Deployment order within rar file
                    ramses

                    Here the stack when start method of the ressource adapter is called:

                     

                    Thread [HDScanner] (Suspended (breakpoint at line 178 in SMSResourceAdapter))     
                         SMSResourceAdapter.start(BootstrapContext) line: 178     
                         RARDeployment.startService() line: 150     
                         RARDeployment(ServiceMBeanSupport).jbossInternalStart() line: 376     
                         RARDeployment(ServiceMBeanSupport).jbossInternalLifecycle(String) line: 322     
                         RARDeployment(ServiceDynamicMBeanSupport).invoke(String, Object[], String[]) line: 124     
                         RawDynamicInvoker.invoke(String, Object[], String[]) line: 164     
                         MBeanServerImpl.invoke(ObjectName, String, Object[], String[]) line: 668     
                         ServiceProxy.invoke(Object, Method, Object[]) line: 189     
                         $Proxy38.start() line: not available     
                         StartStopLifecycleAction.installAction(ServiceControllerContext) line: 42     
                         StartStopLifecycleAction.installAction(ControllerContext) line: 37     
                         StartStopLifecycleAction(SimpleControllerContextAction<T>).simpleInstallAction(T) line: 62     
                         StartStopLifecycleAction(AccessControllerContextAction<S,T>).install(ControllerContext) line: 71     
                         ServiceControllerContextActions(AbstractControllerContextActions).install(ControllerContext, ControllerState, ControllerState) line: 51     
                         ServiceControllerContext(AbstractControllerContext).install(ControllerState, ControllerState) line: 348     
                         ServiceControllerContext.install(ControllerState, ControllerState) line: 286     
                         AbstractKernelController(AbstractController).install(ControllerContext, ControllerState, ControllerState) line: 1631     
                         AbstractKernelController(AbstractController).incrementState(ControllerContext, boolean) line: 934     
                         AbstractKernelController(AbstractController).resolveContexts(ControllerState, ControllerState, boolean) line: 1082     
                         AbstractKernelController(AbstractController).resolveContexts(boolean) line: 984     
                         AbstractKernelController(AbstractController).change(ControllerContext, ControllerState, boolean) line: 822     
                         AbstractKernelController(AbstractController).change(ControllerContext, ControllerState) line: 553     
                         ServiceController.doChange(KernelController, ServiceControllerContext, ControllerState, String) line: 688     
                         ServiceController.start(ObjectName) line: 460     
                         ServiceDeployer.start(ServiceContext) line: 163     
                         ServiceDeployer.deploy(DeploymentUnit, ServiceMetaData) line: 99     
                         ServiceDeployer.deploy(DeploymentUnit, Object) line: 46     
                         ServiceDeployer(AbstractSimpleRealDeployer<T>).internalDeploy(DeploymentUnit) line: 62     
                         ServiceDeployer(AbstractRealDeployer).deploy(DeploymentUnit) line: 50     
                         DeployerWrapper.deploy(DeploymentUnit) line: 171     
                         DeployersImpl.doDeploy(Deployer, DeploymentUnit) line: 1439     
                         DeployersImpl.doInstallParentFirst(Deployer, DeploymentContext) line: 1157     
                         DeployersImpl.doInstallParentFirst(Deployer, DeploymentContext) line: 1178     
                         DeployersImpl.install(ControllerContext, ControllerState, ControllerState) line: 1098     
                         DeploymentControllerContext(AbstractControllerContext).install(ControllerState, ControllerState) line: 348     
                         AbstractKernelController(AbstractController).install(ControllerContext, ControllerState, ControllerState) line: 1631     
                         AbstractKernelController(AbstractController).incrementState(ControllerContext, boolean) line: 934     
                         AbstractKernelController(AbstractController).resolveContexts(ControllerState, ControllerState, boolean) line: 1082     
                         AbstractKernelController(AbstractController).resolveContexts(boolean) line: 984     
                         AbstractKernelController(AbstractController).change(ControllerContext, ControllerState, boolean) line: 822     
                         AbstractKernelController(AbstractController).change(ControllerContext, ControllerState) line: 553     
                         DeployersImpl.process(List<DeploymentContext>, List<DeploymentContext>) line: 781     
                         MainDeployerImpl.process() line: 702     
                         MainDeployerAdapter.process() line: 117     
                         HDScanner.scan() line: 362     
                         HDScanner.run() line: 255     
                         Executors$RunnableAdapter<T>.call() line: 441     
                         FutureTask$Sync.innerRunAndReset() line: 317     
                         ScheduledThreadPoolExecutor$ScheduledFutureTask<V>(FutureTask<V>).runAndReset() line: 150     
                         ScheduledThreadPoolExecutor$ScheduledFutureTask<V>.access$101(ScheduledThreadPoolExecutor$ScheduledFutureTask) line: 98     
                         ScheduledThreadPoolExecutor$ScheduledFutureTask<V>.runPeriodic() line: 181     
                         ScheduledThreadPoolExecutor$ScheduledFutureTask<V>.run() line: 205     
                         ThreadPoolExecutor$Worker.runTask(Runnable) line: 886     
                         ThreadPoolExecutor$Worker.run() line: 908     
                         Thread.run() line: 619
                    

                     

                    I saw in the AbstractKernelController(AbstractController).incrementState the toState is Real and i added this as whenRequired attribute.

                     

                    <dependency xmlns="urn:jboss:dependency:1.0">

                    <item whenRequired="Real">sx.resource.sms:service=SMSCenterManager</item>
                    </dependency>

                     

                    and it works fine.

                     

                     

                    Thank you for your great support!

                    • 7. Re: Deployment order within rar file
                      alesj

                      I saw in the AbstractKernelController(AbstractController).incrementState the toState is Real and i added this as whenRequired attribute.

                       

                      <dependency xmlns="urn:jboss:dependency:1.0">

                      <item whenRequired="Real">sx.resource.sms:service=SMSCenterManager</item>
                      </dependency>

                       

                      and it works fine.

                       

                       

                      Thank you for your great support!

                      Glad it works. :-)

                       

                      But I need to check why the default whenRequired setting doesn't kick in.

                      • 8. Re: Deployment order within rar file
                        alesj

                        But I need to check why the default whenRequired setting doesn't kick in.

                        Well, I added a new test, which mocks your use case and it worked w/o problems:

                        * DependenciesTestCase.java (see testBasicDependency)