1 2 Previous Next 15 Replies Latest reply on Apr 17, 2009 9:27 AM by daniel.holesisnky

    Deployment order causes problem with JBoss 5 CR2

    nouredine13

      Hello,

      I have a sample application with an EJB3 SLSB which is being injected by another jar file as follows :

      1st Bean called A.jar:

      package com.mypkg.repository.session;

      import javax.ejb.EJB;
      import javax.ejb.Stateless;
      import com.jboss.sample.SampleEJBLocal;


      @Stateless (name="StatelessManageUser", mappedName="manageUserMappedName")
      public class manageUserBean implements manageUserRemote,manageUser {

      @EJB
      SampleEJBLocal mysample;

      public void SayHello(){
      mysample.ShowHelloLocal("Hello Local");
      }

      public void SayHelloRemote() {

      mysample.ShowHelloLocal("Hello Remote");
      }

      }

      my Other Bean is as follows :

      2nd Bean called B.jar :

      package com.jboss.sample;

      import javax.ejb.Stateless;

      /**
      * Session Bean implementation class MySampleEJB
      */
      @Stateless(name="MySampleEJB", mappedName = "SampleEJBMappedName")
      public class MySampleEJB implements SampleEJBRemote, SampleEJBLocal {

      public void ShowHelloLocal(String message) {

      System.out.println("Hello every body_local !");
      }

      public void ShowHolloRemote(String message) {

      System.out.println("Hello every body_remote !" + message);

      }

      }


      The application is deployed as an EAR file in the following structure:

      testAB.ear
      |
      |--- META-INF
      | |
      | |----application.xml
      | |

      |--- A.jar (inject SLSB B.jar)
      | |
      | |--- META-INF
      | | |MANIFEST.MF
      | | |
      |
      |
      |
      |--- B.jar (contains the SLSB)
      | |
      | |
      | |--- META-INF
      | |
      | |



      I have the folowing error when i try to deploy my testAB.ear with JBoss 5 CR2,

      Part of the exception is pasted below:

      ...
      Caused by: java.lang.NullPointerException
      at org.jboss.ejb3.javaee.JavaEEComponentHelper.createObjectName(JavaEEComponentHelper.java:46)
      at org.jboss.ejb3.deployers.JBoss5DeploymentScope.getEjbContainer(JBoss5DeploymentScope.java:167)
      at org.jboss.ejb3.Ejb3Deployment.getEjbContainer(Ejb3Deployment.java:431)
      at org.jboss.ejb3.EJBContainer.resolveEjbContainer(EJBContainer.java:1389)
      at org.jboss.injection.AbstractHandler.addDependency(AbstractHandler.java:50)
      at org.jboss.injection.EJBRemoteHandler.ejbRefDependency(EJBRemoteHandler.java:146)
      at org.jboss.injection.EJBRemoteHandler.handleFieldAnnotations(EJBRemoteHandler.java:393)
      at org.jboss.injection.InjectionUtil.processFieldAnnotations(InjectionUtil.java:160)
      at org.jboss.injection.InjectionUtil.processAnnotations(InjectionUtil.java:197)
      at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:572)
      at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:439)
      at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:552)
      at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:202)
      ... 28 more
      2008-12-04 17:17:39,392 ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Real: name=vfszip:/product/jboss/jboss-5.0.0.CR2/server/default/deploy/testAB.ear state=PreReal mode=Manual requiredState=Real
      org.jboss.deployers.spi.DeploymentException: Error deploying A.jar: null
      at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:209)
      at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:108)
      at org.jboss.deployers.vfs.spi.deployer.AbstractVFSRealDeployer.internalDeploy(AbstractVFSRealDeployer.java:45)
      at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
      at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1285)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1003)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1056)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:944)
      at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
      at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1598)
      at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1062)
      at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
      at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
      at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:627)
      at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:541)
      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:290)
      at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:221)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
      at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
      at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.NullPointerException
      at org.jboss.ejb3.javaee.JavaEEComponentHelper.createObjectName(JavaEEComponentHelper.java:46)
      at org.jboss.ejb3.deployers.JBoss5DeploymentScope.getEjbContainer(JBoss5DeploymentScope.java:167)
      at org.jboss.ejb3.Ejb3Deployment.getEjbContainer(Ejb3Deployment.java:431)
      at org.jboss.ejb3.EJBContainer.resolveEjbContainer(EJBContainer.java:1389)
      at org.jboss.injection.AbstractHandler.addDependency(AbstractHandler.java:50)
      at org.jboss.injection.EJBRemoteHandler.ejbRefDependency(EJBRemoteHandler.java:146)
      at org.jboss.injection.EJBRemoteHandler.handleFieldAnnotations(EJBRemoteHandler.java:393)
      at org.jboss.injection.InjectionUtil.processFieldAnnotations(InjectionUtil.java:160)
      at org.jboss.injection.InjectionUtil.processAnnotations(InjectionUtil.java:197)
      at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:572)
      at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:439)
      at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:552)
      at org.jboss.ejb3.deployers.Ejb3Deployer.deploy(Ejb3Deployer.java:202)
      ... 28 more
      2008-12-04 17:17:39,393 DEBUG [org.jboss.classloader.spi.base.BaseClassLoaderDomain] ClassLoaderDomain@15b0e2c{DefaultDomain} unregisterClassLoader BaseClassLoader@2c1f9d{vfszip:/product/jboss/jboss-5.0.0.CR2/server/default/deploy/testAB.ear}
      2008-12-04 17:17:39,393 DEBUG [org.jboss.mx.loading.UnifiedLoaderRepository3] UnifiedLoaderRepository removed(false) null
      2008-12-04 17:17:39,393 DEBUG [org.jboss.classloader.spi.base.BaseClassLoaderPolicy] VFSClassLoaderPolicy@cf9105{vfszip:/product/jboss/jboss-5.0.0.CR2/server/default/deploy/testAB.ear} shutdown!
      2008-12-04 17:17:39,393 DEBUG [org.jboss.classloader.spi.base.BaseClassLoader] BaseClassLoader@2c1f9d{vfszip:/product/jboss/jboss-5.0.0.CR2/server/default/deploy/testAB.ear} shutdown!
      2008-12-04 17:17:39,393 DEBUG [org.jboss.classloading.spi.dependency.Domain] org.jboss.classloading.spi.dependency.Domain@120540c{DefaultDomain} add module VFSDeploymentClassLoaderPolicyModule testAB.ear:0.0.0
      2008-12-04 17:17:39,393 DEBUG [org.jboss.deployers.vfs.plugins.classloader.InMemoryClassesDeployer] Removing dynamic class root for vfszip:/product/jboss/jboss-5.0.0.CR2/server/default/deploy/testAB.ear
      2008-12-04 17:17:39,393 WARN [org.jboss.system.server.profileservice.hotdeploy.HDScanner] Failed to process changes
      org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

      and when i just rename A become B and B become A, the deployment is successful !

      I deduced that there's an alphabetical order deployment !

      is this a Bug ? if it's the case, should i open a bug in JIRA?


      Thank you for your response.
      Thank's a lot.

        • 1. Re: Deployment order causes problem with JBoss 5 CR2
          alesj

           

          "Nouredine13" wrote:

          is this a Bug ? if it's the case, should i open a bug in JIRA?

          Afaik this was resolved in trunk (or/and the upcoming GA).

          btw: what's with the bold markup? :-)

          • 2. Re: Deployment order causes problem with JBoss 5 CR2
            nouredine13

            thank you for your response.

            • 3. Re: Deployment order causes problem with JBoss 5 CR2
              mboulatian

              This is not resolved in GA. Still the same alphabetical order deployment. At least in 4.x you would deploy jar modules first before wars regardless of alphabetical orders.

              • 4. Re: Deployment order causes problem with JBoss 5 CR2
                jaikiran

                You haven't provided much details about your application(s). But based on this statement,

                "mboulatian" wrote:
                At least in 4.x you would deploy jar modules first before wars regardless of alphabetical orders.


                I think there might be a bug in the LegacyDeploymentContextComparator. I didn't realize this would cause deployment ordering issues when i replied in this post http://www.jboss.org/index.html?module=bb&op=viewtopic&t=150147#4208442
                From that post:
                "jaikiran" wrote:

                P.S: Off topic, i see that the .jar is listed twice in the LegacyDeploymentContextComparator. Once with order 400 and then again with order 700.


                The order for jar, because of the overwrite, is 700 and is after the war deployment (=500).


                • 5. Re: Deployment order causes problem with JBoss 5 CR2
                  dimitris

                  .jar appeared twice before because it was added in the list once (400) by the JARDeployer (simple .jars with classes) and twice (700) by the EJBDeployer (ejb jar).

                  • 6. Re: Deployment order causes problem with JBoss 5 CR2
                    alesj

                    I fixed this in 5.0.1.
                    .jar is now only at 700.

                    • 7. Re: Deployment order causes problem with JBoss 5 CR2
                      dimitris

                      What is more "correct" here? Isn't that WARs are using ejb-jars and so, ejb-jars should be started before? (400).

                      The 700 setting before, was essentially ignored because the 400 one was always there (JARDeployer) to override it...

                      • 8. Re: Deployment order causes problem with JBoss 5 CR2
                        jaikiran

                        On a related note, i think in JBossAS-4.x, the end users had the liberty of changing/configuring these deployment order values through the %JBOSS_HOME%/server/< serverName>/conf/xmdesc/org.jboss.deployment.MainDeployer-xmbean.xml:

                        <mbean>
                         <description>The Main deployer is the service which acts as the entry
                         point for the deployment/undeployment requests.
                         </description>
                         <class>org.jboss.deployment.MainDeployer</class>
                        ...
                         <attribute access='read-only' getMethod='getSuffixOrder'>
                         <description>The suffix order used when sorting deployments, constructed dynamically by registering deployers</description>
                         <name>SuffixOrder</name>
                         <type>[Ljava.lang.String;</type>
                         </attribute>
                         <attribute access='read-write' setMethod='setEnhancedSuffixOrder' getMethod='getEnhancedSuffixOrder'>
                         <description>Allows the override of the suffix order declared by subdeployers, using the syntax [order:]suffix
                         </description>
                         <name>EnhancedSuffixOrder</name>
                         <type>[Ljava.lang.String;</type>
                         <!--
                         Statically set one or more enhanced suffix orders, independent of the value proposed by subdeployers.
                         Some deployers may also allow the suffixes/orders to be set locally, so that's preferable too.
                         For reference, this is the list of enhanced suffixes likely to be set by deployers (it may not
                         be completely up-to-date, or there can be user-defined deployers).
                        
                         050:.deployer,050:-deployer.xml,100:.aop,100:-aop.xml,150:.sar,150:-service.xml,200:.beans,250:.rar,300:-ds.xml,350:.har,400:.jar,400:.ejb3,400:.par,500:.war,600:.wsr,650:.ear,700:.jar,750:.zip,800:.bsh,900:.last
                        
                         Until we resolve some startup issues, we'll setup some static enhanced suffix orders bellow
                         and leave the rest of the suffixes contributed dynamically by registering deployers.
                         -->
                         <descriptors>
                         <value value="250:.rar,300:-ds.xml,400:.jar,500:.war,550:.jse,650:.ear,800:.bsh"/>
                         </descriptors>
                         </attribute>


                        Would it be possible to allow such configuration through the MC bean in AS5 for the MainDeployer/comparator?

                        • 9. Re: Deployment order causes problem with JBoss 5 CR2
                          jaikiran

                           

                          "jaikiran" wrote:

                          Would it be possible to allow such configuration through the MC bean in AS5 for the MainDeployer/comparator?


                          Just looked at the LegacyDeploymentContextComparator MC bean and i see that this should be possible in the current version itself through a combination of the useDefault flag setting and the suffixOrder map.

                          • 10. Re: Deployment order causes problem with JBoss 5 CR2
                            jaikiran

                            Haven't given this a try, but i guess this should work (in conf/bootstrap/deployers.xml):

                            <bean name="topContextComparator">
                             <constructor factoryClass="org.jboss.system.deployers.LegacyDeploymentContextComparator" factoryMethod="getInstance"/>
                            
                            <property name="suffixOrder" class="java.util.Map">
                             <map keyClass="java.lang.String" valueClass="java.lang.Integer">
                             <entry>
                             <key>.deployer</key>
                             <value>50</value>
                             </entry>
                            ...
                             <entry>
                             <key>.jar</key>
                             <value>400</value>
                             </entry>
                             <entry>
                             <key>.war</key>
                             <value>500</value>
                             </entry>
                            ...
                             </map>
                             </property>
                             <property name="useDefaults">false</property>
                            </bean>


                            • 11. Re: Deployment order causes problem with JBoss 5 CR2
                              alesj

                               

                              "dimitris@jboss.org" wrote:
                              What is more "correct" here? Isn't that WARs are using ejb-jars and so, ejb-jars should be started before? (400).

                              Yup, it makes sense.
                              Dunno what I was thinking then ... :-)


                              • 12. Re: Deployment order causes problem with JBoss 5 CR2
                                dimitris

                                I guess because the previous (700) for ejbs was essentially wrong!

                                • 13. Re: Deployment order causes problem with JBoss 5 CR2

                                  Hello,

                                  i reopen this question - If i want specific startup order (jar, ear, war ...) is it possible to define order in org.jboss.deployment.MainDeployer-xmbean.xml or only way is via LegacyDeploymentContextComparator(suffixOrder)?

                                  I try it on JBoss AS 5.0.1 and changing EnhancedSuffixOrder does not working. But define order in LegacyDeploymentContextComparator(suffixOrder) works for me.

                                  With regards,

                                  Daniel Holesinsky

                                  • 14. Re: Deployment order causes problem with JBoss 5 CR2
                                    alesj

                                     

                                    "daniel.holesisnky" wrote:

                                    i reopen this question - If i want specific startup order (jar, ear, war ...) is it possible to define order in org.jboss.deployment.MainDeployer-xmbean.xml or only way is via LegacyDeploymentContextComparator(suffixOrder)?

                                    MainDeployer-xmbean.xml is deprecated.
                                    Only LDCC is what we use now.

                                    1 2 Previous Next