2 Replies Latest reply on Nov 15, 2006 12:36 PM by formica

    MBean: parameters name & description of operations with EJB3

    formica

      Hello all,

      I have a few MBeans services defined with EJB 3 annotations. They are made to be used in the JMX console by a user who will call their operations and watch their attributes, so they should be documented enough.
      The problem is that I can't find a way to specify parameters names, operations and attributes description.

      I just found an article http://weblogs.java.net/blog/emcmanus/archive/2005/07/adding_informat.html demonstrating that one can achieve this functionnality defining custom annotations and overriding StandardMBean class to extract informations from our custom annotations. Well this may do the trick, but:

      1/ I don't use registerMBean to do the job, I just annotate my class with @Service. Since I'm fairly new to EJB (this is my first project), and began with EJB 3, I know nothing about this way of registering a MBean. I'm wondering where should I call registerMBean, because obviously, I would need to register MBeans when the application is deployed (but how to have some code executed at this moment ??), and also take care of dependencies between my MBeans, which may imply to respect an accurate call order.

      2/ I would really prefer a pure EJB3 solution relying on @Service and @Depends annotations to register MBeans correctly.

      3/ I can't believe there isn't a built-in solution to document MBeans. Having to rediscover the wheel to implement what I consider as a basic feature compared to what already exist in EJB 3 seems incredible.

      Does anyone knows if there is a way to do this using JBoss annotations or standard annotations. If there isn't, what are the others possibilies ?

      Thanks in advance[/url]

        • 1. Re: MBean: parameters name & description of operations with
          kapilanand

          hi all,
          I am looking for the same solution. I had posted a topic in EJB3 user forum but got no response. I could not find anything documented on this either. Looks like this feature is absent. I was considering to move to XMBeans.
          I see two short-comings in the xmbean solution:
          1. There is no way to separate out application and management interface.
          2. You will have to do something addition to put the service in JNDI:

          Option1: Using deployment descriptor define a RMI adaptor and register it in JNDI. Will be ineffecient if you need only local interface for the service, perhaps in-JVM JBoss JNDI lookup will return a local reference instead of network-enabled stub. (Will make the service remotely available though)

          Option2: Write a separate startup service that creates these services and add them to JNDI programatically (and in the service kernel too perhaps). I am not sure this can be done for ejb3 services.

          I think the JBoss local JNDI implementation store the local reference of the object instead of the serialized copy, so implementing Referenceable might not be needed. (that's what is evident from the example in tutorial that binds a hashtable/hashmap in JNDI and uses it as a live object)

          Please let me know if my information is flawed or same things can be done in a better or different way.

          • 2. Re: MBean: parameters name & description of operations with
            formica

            Thanks for your answer kapilanand.

            Have you got any news about this subject for standard MBeans ?
            I'm trying not to migrate to XMBeans....

            Andrea