9 Replies Latest reply on Sep 10, 2009 11:05 AM by rnicholson10

    Declare a dependency on an MC bean

    rnicholson10

      I'm trying to declare a dependency on the HornetQServer MC bean.

      I took the name of the bean from the JMX Console to create the depends clause but it does not work:

      @Depends(value={"jboss.deployment:id=HornetQServer,type=Component"})
      


      This is the only reference I can find to HornetQServer in the JMX Console.

      The HornetQ forum led me here, this was my original post http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4254388#4254388

      Could someone shed some light on this for me please?

      Cheers,

      Ross

        • 1. Re: Declare a dependency on an MC bean
          alesj

          I need more info.

          Where do you put this @Depends?
          "I have an ServiceBean" tells me nothing.

          What type of service is this?
          How is it deployed?
          ...

          • 2. Re: Declare a dependency on an MC bean
            jaikiran

            1) What does the import statement for @Depends look like (there is a @Depends annotaiton in MC as well as EJB3, so want to make sure you are using the correct one).

            2) In that other post, you mentioned you are adding a @Depends on the HornetQServer like this:

            @Depends(value={"jboss.deployment:id=HornetQServer,type=Component"})


            That's a MBean created for the deployment of the HornetQServer MC bean. I don't think, adding that dependency will work (although i am not sure).

            From what you have been explaining, i guess you want this:

            @org.jboss.beans.metadata.api.annotations.Depends(value={"HornetQServer"})


            By the way, on what component are you placing this dependency? EJB? And please post the complete exception stacktrace that you see.


            • 3. Re: Declare a dependency on an MC bean
              jaikiran

              Ah, too slow to click on submit! Did not see Ales' reply :)

              • 4. Re: Declare a dependency on an MC bean
                rnicholson10

                Apologies,

                I was using a EJB3 Service Bean.

                The solution by Jakiran works correctly and is as follows:

                @Service
                @Local(InputServiceBeanLocal.class)
                @Remote(InputServiceBeanRemote.class)
                @Management(InputServiceBeanManagement.class)
                @Depends(value={"HornetQServer"})
                public class InputServiceBean implements InputServiceBeanLocal, InputServiceBeanRemote, InputServiceBeanManagement
                {
                ...
                }
                


                How would you normally figure out what the correct name is for the MC Bean? Is it simply the id values of the component from the JMX console?

                • 5. Re: Declare a dependency on an MC bean
                  alesj

                   

                  "jaikiran" wrote:

                  @Depends(value={"jboss.deployment:id=HornetQServer,type=Component"})


                  That's a MBean created for the deployment of the HornetQServer MC bean. I don't think, adding that dependency will work (although i am not sure).

                  No it wouldn't.
                  As this is only part of MBeanServer, and not of MC.

                  • 6. Re: Declare a dependency on an MC bean
                    alesj

                     

                    "rnicholson10" wrote:

                    How would you normally figure out what the correct name is for the MC Bean?

                    There are several ways:
                    * look into the -jboss-beans.xml file where this bean is defined --> its name attribute
                    * new admin-console
                    * Grapher tool

                    • 7. Re: Declare a dependency on an MC bean
                      rnicholson10

                      Ok, so I looked in the -jboss-beans.xml file but every bean defined has a name. It's not easy to figure out which is the one I'm looking for.

                      The new admin-console (which I'd never seen before), has absolutely no mention of HornetQServer, nor can I see any mention of micro-containers in the tree listing. Should it be there?

                      • 8. Re: Declare a dependency on an MC bean
                        alesj

                         

                        "rnicholson10" wrote:
                        Ok, so I looked in the -jboss-beans.xml file but every bean defined has a name. It's not easy to figure out which is the one I'm looking for.

                        In the worst case you can ask the HornetQ guys about the name. ;-)
                        If they happen use custom schema, I agree, it can be non-trivial.

                        • 9. Re: Declare a dependency on an MC bean
                          rnicholson10

                          I love it!

                          I'll let them know the solution and they can add it to their WIKI, it'll save others the hassle of the search.

                          Thanks a million,

                          R.