6 Replies Latest reply on Jun 24, 2009 6:27 PM by Ilgar M

    Dependency of modules inside of EAR file

    Ilgar M Newbie

      Hi all,

      I have EAR file with 3 modules inside: 2 sar and 1 ejb jar.

      mq-service.sar - queue definitions are here
      ejb.jar - ejb mdb classes
      service.sar - other mbeans

      The problem is that ejb is loaded before mq_service.sar and when MDB tries to bind to queue it cannot find the queue, so I have ejb module not deployed.

      I do not want to touch MainDeployer order, so I am trying to create my own SubDeployer.

      I have tried to create SubDeployer mbean from SubDeployerSupport based on guidlines on http://www.jboss.org/community/wiki/MainDeployerEnhancedSuffixOrder, but there is no information on how to package it and where to put.

      should it be in deployers directory or deploy?
      should mbean definitions be specified in jboss-service.xml or jboss-beans.xml?

      does anyone have faced such problem with loading order? Is there sample for SubDeployerSupport implementation? Should I just initialize EnhancedSuffixes attribute in constructor via set method?

      Thanks in advance for any information.

        • 1. Re: Dependency of modules inside of EAR file
          Ilgar M Newbie

          ok, I have figured out how to configure it, but the error I get is:

          02:05:44,921 ERROR [AbstractKernelController] Error installing to Create: name=MSPDeployer state=Configured
          java.lang.RuntimeException: Error creating MBeanProxy: jboss.system:service=MainDeployer
          at org.jboss.mx.util.MBeanProxyExt.init(MBeanProxyExt.java:415)
          at org.jboss.mx.util.MBeanProxyExt.(MBeanProxyExt.java:99)
          at org.jboss.mx.util.MBeanProxyExt.create(MBeanProxyExt.java:394)
          at org.jboss.mx.util.MBeanProxyExt.create(MBeanProxyExt.java:349)
          at org.jboss.deployment.SubDeployerSupport.createService(SubDeployerSupport.java:112)
          at org.jboss.Main.boot(Main.java:221)
          at org.jboss.Main$1.run(Main.java:556)
          at java.lang.Thread.run(Thread.java:595)
          Caused by: java.lang.NullPointerException
          at org.jboss.mx.util.MBeanProxyExt.init(MBeanProxyExt.java:407)

          I have checked with jboss source code, here is that section:

          112 mainDeployer = (MainDeployerMBean)
          113 MBeanProxyExt.create(MainDeployerMBean.class,
          114 MainDeployerMBean.OBJECT_NAME,
          115 server);

          I expect that MainDeployer is already available at that moment, so I have tried to add dependencies on jboss.system:service=MainDeployer, but the same. What have I missed?

          my jboss-beans.xml file:

          <deployment xmlns="urn:jboss:bean-deployer:2.0">
          <bean name="MSPDeployer" class="deployer.JBossDeployer">
          <property name="enhancedSuffixes">100:mq-service.sar,101:ejb.jar,102:service.sar,103:.war</property>


          • 2. Re: Dependency of modules inside of EAR file
            Wolfgang Knauf Master


            I think you could place the Queue definitions in the ejb-jar (in META-INF\...-service.xml). This would probably work around the issue.

            The EJBs should have @Depends annotations, which point to the Queues:

            @MessageDriven (activationConfig=
             @ActivationConfigProperty(propertyName="destinationType", propertyValue="javax.jms.Queue"),
             @ActivationConfigProperty(propertyName="destination", propertyValue="queue/MessageBeanQueue")
            @Depends(value = "...:service=Queue,name=MessageBeanQueue")
            public class MessageBean implements MessageListener

            Hope this helps


            • 3. Re: Dependency of modules inside of EAR file
              Ilgar M Newbie

              Hi Wolfgang,

              Thanks for your advice, @Deploy seems to be reasonable, but it does not help nor copying -service.xml to META-INF of ejb.jar, I think it is being ignored there.

              don't know why @Deploy is not processed, because I specify exactly the same JMX queue name as I do in another -service.xml where I load my service mbeans, which are also dependant on queues.

              So currently, I am just copying two files to deploy, .ear with application and .sar with queue definitions (which I copy first).

              Thanks for your time!

              Does anyone have experience with SubDeployers?

              • 4. Re: Dependency of modules inside of EAR file
                Ales Justin Master


                "ilgarm" wrote:
                Does anyone have experience with SubDeployers?

                There are none SubDeployers in AS5.

                You have StructureDeployers or plain Deployers.

                • 5. Re: Dependency of modules inside of EAR file
                  Ales Justin Master

                  The old MainDeployer is just used for legacy/test purposes.
                  The new VDF layer completely replaces old deployers.
                  You should *not* rely on them any more.

                  What you could do, is add jboss-structure.xml file into your .ear/META-INF,
                  where you would list your sub-deployments or set your custom sub-deployment comparator.
                  See this on how to use jboss-structure.xml: http://www.jboss.org/community/docs/DOC-13178

                  • 6. Re: Dependency of modules inside of EAR file
                    Ilgar M Newbie


                    Thanks a lot, this is exactly what I was looking for. I will try to configure it tomorrow.