2 Replies Latest reply on Aug 3, 2004 1:03 AM by Elias Ross

    mbean / sar depend on a war?

    Les Hazlewood Newbie

      Is there a way for an MBean (SAR) to depend on a web application WAR being deployed/started first?

      I have a notification service (MBean) I would like to start only after everything else has deployed and started (which includes the web application being up and running).

      I know a standard way is to start the service by looking up the MBean from JNDI from a ServletContextListener in the web tier (implying the web tier is the last component to be deployed). Therefore, when the context listener is executed after startup, you can assume everything else in the whole application has been deployed.

      Although this is OK, it would be a lot easier and quicker if I can just specify the following mbean definition:

      <mbean code="com.some.JmxMBeanImpl"
       name="MyDomain:service=MyJmxImpl">
       <depends>jboss:service=Naming</depends>
       <depends>jboss.jca:name=hibernateService,service=hibernateService</depends>
       <depends>jboss.management.local:J2EEApplication=myapp.ear,J2EEServer=Local,j2eeType=WebModule,name=myapp.war</depends>
      </mbean>


      (where myapp.war is inside myapp.ear).

      Having a legitimate depends tag is nicer than the servlet approach in some cases because sometimes we may not even want to start the service upon deployment. In this case, we'd have to change code to prevent the service from being started. The depends approach would allow us to just change a config file only.

      I thought the above code would work, but it doesn't. Am I specifying the war depends tag wrong?

      Any help at all is greatly appreciated.

      Regards,

      Phar