1 Reply Latest reply on Nov 2, 2002 7:38 AM by adrian.brock

    MBean name - given a class name

    kay_haribabu

      hai all,
      I have got an MBean and I deployed it by packaging it as a SAR file and using jboss-service.xml.

      MBean:
      public class Interface MyExampleMBean
      {
      ......

      }


      MBean Implementation:
      public class MyExample implements MyExampleMBean
      {
      ......

      }


      My jboss-service.xml:




      At runtime i will be provided with the class name of the MBean("MyExample"). Is it possble to find the name of the MBean(mymbean.example:service=PA) by using the class name?

      Can anybody help me out?

      Hari Babu

        • 1. Re: MBean name - given a class name

          import javax.management.MBeanServer;
          import javax.management.Query;
          import javax.management.QueryExp;

          MBeanServer server = ...
          QueryExp query = Query.eq
          (
          Query.classattr(), Query.value("yourclassname")
          );
          Set set = server.queryNames(null, query);

          or something like that.

          Regards,
          Adrian