1 2 Previous Next 24 Replies Latest reply on Apr 29, 2004 10:35 AM by Hussein Badakhchani

    Deploy Order - how?

    dxbcto Newbie

      Hello,

      I have a small application deployed on JBoss 3.2.3 which consists of EJBs and JMXes. The problem is that, upon deployment, the JMXes come up first and they try to use the yet-to-be-deployed EJBs. How can I make sure that the EJBs deploy ahead of the JMXes?

      Thanks in advance.

      Regards,
      Khaled

        • 1. Re: Deploy Order - how?
          jae Master

          use the

           <depends> </depends>
          


          element in your mbean's jboss-service.xml file to state that the mbean should not be deployed until your ejbs are deployed.

          you can find examples of this in the main jboss-service.xml file in the conf directory.

          • 2. Re: Deploy Order - how?
            dxbcto Newbie

            Thank you very much for your quick response. I appreciate it.

            Regards,
            Khaled

            • 3. Re: Deploy Order - how?
              Hussein Badakhchani Newbie

              Hello,

              I am having difficulty with the tags

              my sars jboss-service.xml file:

              <?xml version="1.0" encoding="UTF-8"?>


              jboss:j2ee:jndiName=ejb/SystemSettingBeanLocal,service=EJB jboss:j2ee:jndiName=ejb/SessionManagerBeanLocal,service=EJB <!--depends>jboss:j2ee:service=EjbModule,module=systemsetting.jar jboss:j2ee:service=EjbModule,module=sessionmanager.jar</depends--> <!--depends>jboss:j2ee:service=EjbModule</depends-->



              As you can see I have tried a couple different ways to try an persuade the deployer to load my sar file after the EJBS, but so far no luck.

              The sar file is always deployed first and consequntly I get an ejb not bound NamingEcxception and the entire EAR fails to deploy.

              The sar file is deployed inside an exploded ear, the sar file itself is archieved. I am using Jboss 3.2.3.

              Any suggestions?

              Hoos

              • 4. Re: Deploy Order - how?
                jae Master

                sars will allows be deployed first (unless using the PrefixSorter deployer).

                can you repost your jboss-service.xml file (wrap it in a code block pls) and also post the jndi name(s) of the ejb(s) you are trying to look up.

                • 5. Re: Deploy Order - how?
                  Hussein Badakhchani Newbie

                  Ahh, PrefixSorter currently commented out in the jboss-service.xml.

                  The jboss-service.xml file for my sar file is

                  <?xml version="1.0" encoding="UTF-8"?>
                  <service>
                   <mbean code="com.xensia.jmx.SessionManager"
                   name="xensia.jmx:name=SessionManagerMBean">
                  
                  <depends>jboss:j2ee:jndiName=ejb/SystemSettingBeanLocal,service=EJB</depends> <depends>jboss:j2ee:jndiName=ejb/SessionManagerBeanLocal,service=EJB</depends>
                  <!--depends>jboss:j2ee:service=EjbModule,module=systemsetting.jar</depends>
                  <depends>jboss:j2ee:service=EjbModule,module=sessionmanager.jar</depends-->
                  <!--depends>jboss:j2ee:service=EjbModule</depends-->
                  </mbean>
                  
                  </service>
                  


                  Perhaps I should rename this to sessionjmxmanager-service.xml?

                  I will try altering the jboss-service.xml as described.

                  • 6. Re: Deploy Order - how?
                    jae Master

                    i'm not really sure if this makes a difference, but try this as your jboss-service.xml file

                    <?xml version="1.0" encoding="UTF-8"?>
                    <service>
                     <mbean code="com.xensia.jmx.SessionManager"
                     name="xensia.jmx:name=SessionManagerMBean">
                    
                    <depends>jboss:j2ee:service=EJB,jndiName=ejb/SystemSettingBeanLocal</depends>
                     <depends>jboss:j2ee:service=EJB,jndiName=ejb/SessionManagerBeanLocal</depends>
                    </mbean>
                    
                    </service>
                    


                    i always define the service first, and and then the jndiName. also, try deploying the sar w/o the ejb and see what it does. it should deploy but give you a message stating that it depends on your ejb that hasn't been deployed. if it's not doing that, then it's not picking up the dependency properly.

                    also, how are you packing things? as an ear w/ a sar and a jar, are you just deploying the sar and jar directly into the deploy directory?

                    • 7. Re: Deploy Order - how?
                      Hussein Badakhchani Newbie

                      Hello,

                      I have tried using the PrefixDeploymentSorter but still no luck

                      my jboss-service.xml file looks like:

                       <!--attribute name="URLComparator">org.jboss.deployment.DeploymentSorter</attribute-->
                       <attribute name="URLComparator">org.jboss.deployment.scanner.PrefixDeploymentSorter</attribute>
                      



                      The comments in the jboss-service.xml file suggest I should start the name portion of the url with a decimal e.g 2servicejmxmanager.sar, however I this also did not seem to work (also I don't realy want to name my files file decimals), so here are the details of my application deployment.

                      An exploded EAR file with EJBS and WEBAPPS and currently one SAR file
                      EAR
                      |
                      |-META-INF
                      | |--application.xml
                      | |--jboss-app.xml
                      |
                      |-EJB
                      |
                      |-SessionJMXManager(SAR)
                      | |
                      | |-META-INF
                      | |--jboss-service.xml

                      The SessionJMXManager depends on two EJBs, sessionmanager and systemsetting the jndi names are:

                      ejb/SessionManagerBeanLocal
                      ejb/SystemSettingBeanLocal

                      The deployment exception is


                      org.jboss.deployment.DeploymentException: create operation failed for package file:/C:/jboss-3.2.3/s
                      erver/default/deploy/xibms.ear/sessionjmxmanager.sar; - nested throwable: (org.jboss.deployment.Depl
                      oymentException: ejb not bound; - nested throwable: (javax.naming.NameNotFoundException: ejb not bou
                      nd))


                      What am I missing?

                      • 8. Re: Deploy Order - how?
                        dxbcto Newbie

                        Hello,

                        I tried using your suggestion above and it worked for me:-) Here is how my mbean looks like:

                        <!-- The <depends> attribute is to force the EJBs to be depoloyed before the JMX -->
                         <mbean code="com.hmc.eccpm.mbeans.wgenerator.WGenerator" name="ccpm:service=wgenerator">
                         <depends>jboss.j2ee:service=EjbModule,module=eccpm.jar</depends>
                         </mbean>


                        I am pretty sure my deployment is simpler than yours.....but I did get an error when my tag contained jboss:j2ee as opposed to jboss.j2ee.

                        I hope this helps. Anyway, thank you again for helping me solve my problem.

                        Regards,
                        Khaled

                        • 9. Re: Deploy Order - how?
                          Raja Master

                          The order does not matter(whether you put the code first or the name first in the mbean tag). The original problem u had was with the jboss:j2ee instead of jboss.j2ee, Lookup the http://localhost:8080/jmx-console to see how the object names are defined. They are of the format domain:serviceName where domain can be jboss.j2ee or jboss.jca etc.

                          PrefixDeploymentSorter works in such a way that your deployment is done based on an alphabetical sorting order. So just changing tht wont work, you have to change the names of ur deployment entities so that you order which one should be deployed first. In your case, you would name the ejb's alphabetically lower than the SARs so that ejbs get deployed first.

                          • 10. Re: Deploy Order - how?
                            Hussein Badakhchani Newbie

                            Khaled,

                            I'm glad you got it working, my EAR is still bombing out.

                            Are you deploying your EJBs and JMX beans in an EAR file or seperately?

                            Hoos

                            • 11. Re: Deploy Order - how?
                              Hussein Badakhchani Newbie

                              ok here is my new jboss-service.xml file for my mbean

                              
                              <service>
                              
                               <mbean code="com.xensia.jmx.SessionManager"
                               name="xensia.jmx:name=SessionManagerMBean">
                              
                               <depends>jboss.j2ee:service=EjbModule,module=systemsetting.jar</depends>
                               <depends>jboss.j2ee:service=EjbModule,module=sessionmanager.jar</depends>
                               </mbean>
                              
                              </service>
                              
                              


                              I also tried renaming by mbean to xsessionjmxmanager but I still get the same error. Everything loads up corretly until I get to my EAR, then the first thing to be deployed in the ear is my mbeans sar. I have also tried placing the mbean outside the ear file, but this also fails.

                              I guess the problem here is the fact that the mbean is deployed in an EAR, my understanding of the Jboss deployers is a bit limited so looks like its time to check the source code.

                              Does any one have mbeans that are deployed in an EAR that depend on mutiple EJB's or an MBean that depends on an EAR?

                              This is important to me as it I would have to write a nasty script to manage the deployment of my application everytime jboss is restarted (stop jboss, remove mbean, start jboss, wait until eveything is deployed then deploy mbean).

                              Thanks everyone for your suggestions.

                              Cheers,
                              Hoos

                              • 12. Re: Deploy Order - how?
                                Raja Master

                                Can you check if the name specified in ur depends tag is the same as shown in jmx-console for ur beans (including all the attributes)

                                • 13. Re: Deploy Order - how?
                                  Hussein Badakhchani Newbie

                                  Raja,

                                  From my management console


                                  jndiName=ejb/SessionManagerBean,plugin=cache,service=EJB
                                  jndiName=ejb/SessionManagerBean,plugin=pool,service=EJB
                                  jndiName=ejb/SessionManagerBean,service=EJB

                                  jndiName=ejb/SystemSettingBean,plugin=cache,service=EJB
                                  jndiName=ejb/SystemSettingBean,plugin=pool,service=EJB
                                  jndiName=ejb/SystemSettingBean,service=EJB

                                  module=sessionmanager.jar,service=EjbModule

                                  module=systemsetting.jar,service=EjbModule


                                  • 14. Re: Deploy Order - how?
                                    Hussein Badakhchani Newbie

                                    Hello,

                                    Following jae suggestion I have tried deploying my mbean on its own.
                                    It fails with ClassNotFoundExceptions rather than saying anything about dependencies, so it looks like my depends tags are not be resolved correctly.

                                    Any suggestions?

                                    1 2 Previous Next