2 Replies Latest reply on Oct 19, 2012 12:08 PM by Reesa Phillips

    MBean dependencies in JBoss 7

    Natasha Ivanovna Newbie

      Hello,

      I'm trying to deploy an ear, which consits of sar with mxbeans and ejb-jar with stateless and message-driven beans. I have defined dependencies for my mxbeans in the jboss-service.xml file like this:

       

      <mbean name="companyname.jmx:name=DependentMBean" code="companyname.DependentMBean">
        <depends>companyname.jmx:name=timer</depends>

      </mbean>

      <mbean name="companyname.jmx:name=timer" code="companyname.TimerMBean" />

       

      The TimerMBean extends javax.management.timer.Timer and therefore is NotificationEmitter. When I start the DependentMBean (which is NotificationListener), I try to add it to the TimerMBean :

       

      mbServer.addNotificationListener(timerObjName, this, filter, null);

       

      Unfortunately, it fails with InstanceNotFoundException : companyname.jmx:name=timer. I don't think this is correct, because the dependency should prevent DependentMBean from starting until the timer is set up and ready to go. Am I specifying it wrong? Could the problem lie in the fact that I'm using MXBeans instead of the standard MBeans?

      P.S. I've checked the jboss-service schema (https://github.com/jbossas/jboss-as/blob/master/build/src/main/resources/docs/schema/jboss-service_7_0.xsd) and changed the dependencies according to it:

       

      <depends><mbean name="companyname.jmx:name=timer" code="companyname.TimerMBean" /></depends>

       

      but, in this case, it fails with exception during deployment : java.lang.IllegalArgumentException: Name must not be null.

      P.P.S. Also, if I need to access any of my stateless ejbs, how do I specify dependency on them? In jboss 4, it was like this :

       

      <depends>jboss.j2ee:module=SomeEJBJar.jar,service=EjbModule</depends>

       

      any changes in the new version?