3 Replies Latest reply on Jan 22, 2010 4:08 AM by luv zorabian

    JBoss 5.1.0 Deployment Problem

    Justin G Newbie

      Hello,

       

      I'm trying to migrate a web application from JBoss 4.2.2 to 5.1.0, but I'm hung up on a deployment dependency issue.  My ear contains 3 modules; myGui.war, myServer.jar, and config-service.xml.  The config-service module contains mbean declarations for creating JMS queues and loading a java properties file, so it needs to be deployed first.  How can I achieve this, as it is currently being deployed last (it deployed fine in jboss 4.2.2).

       

      My application.xml looks similar to this:

      <?xml version="1.0" encoding="UTF-8"?>
      <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns="http://java.sun.com/xml/ns/javaee"
          xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
          id="Application_ID" version="5">
          <module>
              <web>
                  <web-uri>myGui.war</web-uri>
                  <context-root>MyGui</context-root>
              </web>
          </module>
          <module>
              <ejb>myServer.jar</ejb>
          </module>
      </application>
      

       

      My jboss-app.xml looks similar to this:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD Java EE Application 5.0//EN"
          "http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd">
      <jboss-app>
          <loader-repository>
              net.myapp:archive=myEar.ear
              <loader-repository-config> java2ParentDelegation=false 
              </loader-repository-config>
          </loader-repository>
          <module>
              <service>config-service.xml</service>
          </module>
      </jboss-app>
      

       

      Thanks.

       

      justin.

        • 1. Re: JBoss 5.1.0 Deployment Problem
          Gilles Dupont Tagne Tagne Newbie

          Hi Justin,

           

          if you have MessageDrivenBean in your myServer.jar you could do this.

           

          For example your have this in your config-service.xml

           

          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE server PUBLIC "-//JBoss//DTD MBean Service 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-service_5_0.dtd" >
          <server>
          
               <mbean code="org.jboss.jms.server.destination.QueueService" name="org.jboss.jms:service=Queue,name=myQueue"
                    xmbean-dd="xmdesc/Queue-xmbean.xml">
                    <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
                    <depends>jboss.messaging:service=PostOffice</depends>
               </mbean>
          </server>
          

           

          you have to put this annotations on your MDBean class @org.jboss.ejb3.annotation.Depends

           

          @MessageDriven(...)
          @Depends({"org.jboss.jms:service=Queue,name=myQueue"})
          public class MDBean implements MessageListener {
          
          }
          

           

          the MDBean will be deploy after the queue/myQueue

          • 2. Re: JBoss 5.1.0 Deployment Problem
            Justin G Newbie

            Thanks for the reply!  Does your solution imply that there is no way to force config-service.xml to be deployed first?  Much of the code also depends on properties that don't get loaded until config-service.xml is deployed, so my preferred solution is to modify the deployment order.

             

            Thanks.

             

            justin.

             

            EDIT: Worst case, I know I can just throw config-service.xml into the deploy directory, but I was hoping to deploy it in the ear.

             

            ANOTHER EDIT: I ended up sprinkling @Depends annotations around for the queues and properties.  Thanks again for the reply.

            • 3. Re: JBoss 5.1.0 Deployment Problem
              luv zorabian Newbie

              I guess you can set some order for the deployment using URL Comparator.

              But pls check suitable name in your version.

               

              Like in jboss4 its,

              org.jboss.deployment.scanner.PrefixDeploymentSorter

               

              in AS-5 its .

              LegacyDeploymentContextComparator

               

              may this could help you some way.