3 Replies Latest reply on Jun 16, 2015 8:45 AM by adam_ar

    MBean depedency in JBoss AS 7.1.1

    trupti.r

      Hi all,

       

      I am facing a problem related to dependency of MBean on another MBean in JBoss AS 7.1.1.

       

      Following is my jboss-service.xml

           <server xmlns="urn:jboss:service:7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                xsi:schemaLocation="urn:jboss:service:7.0 jboss-service_7_0.xsd">

        

                   <mbean code="com.test.SettingsService" name="jboss.test:service=Settings">

                   </mbean>

       

                   <mbean code="com.test.engine.KeyService" name="jboss.test:service=KeyService">

                            <depends>jboss.test:service=Settings</depends>

                   </mbean>

          </server>   

       

      When I starts JBoss AS 7.1.1 in standalone mode, sometimes I get exception as

                          Caused by: javax.management.InstanceNotFoundException: jboss.test:service=Settings

                          at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1092)

       

      This exception is random and occurs at times. It seems that JBoss AS 7.1.1 ignores <depends> attribute of MBean and tries to create it even before the dependent MBean instance is created.

       

      Is there any solution for this? I have lot many such services. So generic solutions will be help.

       

      Any ideas?

        • 1. Re: MBean depedency in JBoss AS 7.1.1
          rhanus

          checkagain your deployments

          you have defined 2 services here: jboss.test:service=Settings and jboss.test:service=KeyService

          but jboss complains about missing service jboss.dvantage:service=Settings so somewhere in your deployments you reference the later

          • 2. Re: MBean depedency in JBoss AS 7.1.1
            trupti.r

            Hi Radim. I have changed the exception code. I wrongly placed other exception. there is only one service jboss.test:service=Settings.


            What I have observe, I think is Jboss starts multiple threads for each service, so if any thread which has dependency on other Mbean runs first before the dependent service, we will get such exceptions. Not sure though. What you think

            • 3. Re: MBean depedency in JBoss AS 7.1.1
              adam_ar

              Hey Trupti,

               

              were you able to find a way to manage the dependencies?