3 Replies Latest reply on Mar 12, 2009 10:30 AM by kyle.bober

    MBean depends on a stateless EJB

    franbekh

      Hello,

      I'm developing a MBean that needs a dependency on an deployed EJB. As described in the WIKI, I tried the -Tag and the @Depends annotation (see http://www.jboss.org/community/docs/DOC-9879). The SAR-Archive is deployed withing my EAR.

      @Depends("jboss.j2ee:jndiName=MySchedulerBean,service=EJB3")
      public class StartupService extends ServiceMBeanSupport implements StartupServiceMBean
      {
      @EJB
      MyScheduler scheduler;
      ....

      public void createService()
      {
      scheduler.start();
      }
      }

      The dependant bean is a stateless session bean. The JBoss version I'm using is 4.2.3. During the startup of jboss I get the following error message:

      --- MBeans waiting for other MBeans ---
      ObjectName: my.company:service=StartupService
      State: CONFIGURED
      I Depend On:
      jboss.j2ee:jndiName=MySchedulerBean,service=EJB3

      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: jboss.j2ee:jndiName=MySchedulerBean,service=EJB3
      State: NOTYETINSTALLED
      Depends On Me:
      my.company:service=StartupService

      It seems that the MBean deployer is waiting for the EJB to get ready, but it failed. Can someone tell me where my mistake is. I just want to make sure that the EJB is available for using.

      Thanks in advance,
      Bernd

        • 1. Re: MBean depends on a stateless EJB
          j-n00b

          Hello,

          I am not confident with the JBoss classes, so I tried a similar example with standard MBeans. Using the @Depends annotation, it did not work. So I used the standard jboss-service.xml with the following content:

          <?xml version="1.0" encoding="UTF-8"?>
          
          <server>
           <mbean code="ae.Master" name="ae:service=Master">
           <depends>
           jboss.j2ee:jar=CalculationEJB.jar,name=AdditionBean,service=EJB3
           </depends>
           </mbean>
          </server>


          That way, my MBean waited for the EJB to be deployed. Please note: This notation works for JBoss 5.0.0 GA, maybe you have to adapt it a little.

          Hope that helped a little...

          cheers,
          Andre

          • 2. Re: MBean depends on a stateless EJB
            franbekh

            Hello,

            thanks for the quick answer. Unfortunately it does not work either. I tried all these possibilities....

            Bernd

            • 3. Re: MBean depends on a stateless EJB
              kyle.bober

              I am running into the same issuw as yourself. Were you able to figrue out a solution to this.

              I too have a MBean that has a dependency on an Stateless EJB3 bean.

              Snippet of the MBean

              @Service
              @Management(IChartServiceJMX.class)
              public class ChartServiceJMX implements IChartServiceJMX
              {
               /**
               * Logger for this class
               */
               private static final Logger LOGGER = Logger.getLogger(ChartServiceJMX.class);
              
               private ChartAdminService theChartAdminService;
              
               @Depends("jboss.j2ee:jndiName=ChartAdminServiceEJB,service=EJB3")
               public void setChartAdminService(ChartAdminService aChartAdminService)
               {
               this.theChartAdminService = aChartAdminService;
               }
              


              Snippet of the EJB3 Bean

              @Stateless(mappedName="ChartAdminServiceEJB")
              @WebService(name="chartAdminService", serviceName="chartAdminService")
              @SOAPBinding(style=SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL, parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
              @TransactionManagement(TransactionManagementType.CONTAINER)
              public class ChartAdminService extends BaseService implements IChartAdminService
              


              I receive the following when I attempt to deploy the EAR file that contains the EJB jar which contains the MBean and Stateless EJB3 Bean.

              Thanks,
              Kyle