6 Replies Latest reply on Mar 4, 2008 5:57 AM by Frank Henry

    MyMBean depending on MyOtherMBean issues

    Frank Henry Novice

      Hi!

      I have two MBeans, MyMBean and MyOtherMBean and I want the first to depend on the latter.

      Each is in its own sar and both have services. (the faq mentions non-service issues)
      I have my mbeans mapped in their jboss-service.xml.
      Everything works fine if I hot-deploy it and they all show up in the jmx-console.

      But when I restart the server, I get

      javax.management.InstanceNotFoundException: com.example.mymbean:service=MyService is not registered
      


      I have been surfing the web for the better of two days trying to figure out what I am doing wrong.

      I am probably missing something really simple and any help is appreciated.

      Thanks!

        • 1. Re: MyMBean depending on MyOtherMBean issues
          Peter Johnson Master

          For the MyMBean, do you have a depends clause that references MyOtherMBean? If not, add one. If this doesn't help, If so, please post the *-service.xml files for both mbeans.

          • 2. Re: MyMBean depending on MyOtherMBean issues
            Frank Henry Novice

            Thanks for the reply.

            Yes, I have the depends in the MyMBean's *-service.xml.

            here are the contents:
            MyOtherMBean jboss-service.xml

            <?xml version="1.0" encoding="UTF-8"?>
            
            <server>
             <mbean
             code="com.example.myothermbean.MyOtherMBean"
             name="com.example.myothermbean:service=MyOtherMBean">
            
             <mbean>
             <description>MyOtherMBean</description>
             <class>com.example.myothermbean.MyOtherMBean</class>
            
             <operation>
             <description>JBoss lifecycle operation</description>
             <name>start</name>
             <return-type>void</return-type>
             </operation>
             <operation>
             <description>JBoss lifecycle operation</description>
             <name>stop</name>
             <return-type>void</return-type>
             </operation>
             <operation>
             <description>JBoss lifecycle operation</description>
             <name>create</name>
             <return-type>void</return-type>
             </operation>
             <operation>
             <description>JBoss lifecycle operation</description>
             <name>destroy</name>
             <return-type>void</return-type>
             </operation>
            
             <attribute access='read-write' getMethod='getStarted' setMethod='setStarted'>
             <description>Server stated.</description>
             <name>Started</name>
             <type>boolean</type>
             </attribute>
            
             </mbean>
             </mbean>
            </server>
            


            MyMBean
            <?xml version="1.0" encoding="UTF-8"?>
            
            <server>
             <mbean
             code="com.example.mymbean.MyMBean"
             name="com.example.mymbean:service=MyMBean">
            
            <depends>com.example.myothermbean:service=MyOtherMBean</depends>
            
             <mbean>
             <description>MyMBean</description>
             <class>com.example.mymbean.MyMBean</class>
             <operation>
             <description>JBoss lifecycle operation</description>
             <name>start</name>
             <return-type>void</return-type>
             </operation>
             <operation>
             <description>JBoss lifecycle operation</description>
             <name>stop</name>
             <return-type>void</return-type>
             </operation>
             <operation>
             <description>JBoss lifecycle operation</description>
             <name>create</name>
             <return-type>void</return-type>
             </operation>
             <operation>
             <description>JBoss lifecycle operation</description>
             <name>destroy</name>
             <return-type>void</return-type>
             </operation>
             </mbean>
             </mbean>
            </server>
            


            Again, thanks!

            • 3. Re: MyMBean depending on MyOtherMBean issues
              Peter Johnson Master

              Which version of JBossAS are you using?

              • 4. Re: MyMBean depending on MyOtherMBean issues
                Frank Henry Novice

                4.2.2.GA standard binaries.

                I had also thought it might have something to do with our edited verion of JBoss, but even a fresh one off the download server has the issues.

                From the console I can see that the dependend ist started right before the provider.

                Maybe it will help if I explain what the actual intention is:
                I am writing some PoofOfConcepts and have two MBeans.

                * ExtendedServer which is intended to extend the functionality of the JBOss ServerImpl MBean. All our clients currently listen and poll the ServerImpl MBean for the servers state. The state of the server and the notifications define if the clients can connect or not.
                The ExtendedServer simply offers the ability to simulate server states and thus f.i. kick all the clients off the server for maintenance work.

                * BroadcasterMBean registers itself onto the ExtendedServer and broadcasts the notifications it receives from the ExtendedServer into the Lan.

                As each has it's own SAR the BroadcasterMBean depends on the ExtendedServer.

                So maybe I am missing something else?

                • 6. Re: MyMBean depending on MyOtherMBean issues
                  Frank Henry Novice

                  Thanks Dimitris!

                  Though I still have my dependency problem.