2 Replies Latest reply on Mar 16, 2012 5:13 AM by ochaloup

    List of all the mbeans in jboss-as-7.1.0.Final

    aslamcl

      Hi,

       

      I would like to know all the mbeans availabe in jboss-as-7.1.0.Final.

       

      Is there any documentation for that?

       

      Thanks

      Aslam

        • 1. Re: List of all the mbeans in jboss-as-7.1.0.Final
          aslamcl

          Though I couldnt find any document, the following program will do the same.

           

          The following progam will list the mbeans.

           

          import java.io.IOException;

          import java.util.Set;

           

          import javax.management.MBeanServerConnection;

          import javax.management.ObjectName;

          import javax.management.remote.JMXConnector;

          import javax.management.remote.JMXConnectorFactory;

          import javax.management.remote.JMXServiceURL;

           

          /**

          * To run this program, add jboss-client-7.1.0.Final.jar

          * This class will list the mbeans registered in the server

            */

          public class RegisteredMbeansFinder {

           

              /**

               *

               */

              private static MBeanServerConnection connection;

           

              /**

               *

               */

              private static JMXConnector connector;

           

              public static void Connection(String hostname, String port) throws IOException {

                  String urlString = System.getProperty("jmx.service.url", "service:jmx:remoting-jmx://" + "localhost" + ":" + port);

                  JMXServiceURL address = new JMXServiceURL(urlString);

                  connector = JMXConnectorFactory.connect(address, null);

                  connection = connector.getMBeanServerConnection();

                  System.out.println("GOT THE MBeanServerConnection---SUCCESSFULLY");

              }

           

               private static void listAllJBossAS7MBeans() throws Exception {

                  // ObjectName serviceRef=new ObjectName("jboss.as:*");

                  ObjectName serviceRef = new ObjectName("*.*:*");

                  Set<ObjectName> mbeans = connection.queryNames(serviceRef, null);

                  for (ObjectName on : mbeans) {

                      System.out.println("\t ObjectName : " + on);

                  }

              }

           

           

              private static void getThreadDetails() throws Exception {

                  ObjectName serviceRef = new ObjectName("java.lang:type=Threading");

                  Integer daemonThreadCount = (Integer) connection.getAttribute(

                          serviceRef, "DaemonThreadCount");

                  System.out.println("\t daemonThreadCount : " + daemonThreadCount);

              }

              public static void main(String[] args) throws Exception {

                  Connection("localhost", "9999");

                  System.out.println("All JBoss AS7 MBean Listing:");

                  listAllJBossAS7MBeans();

              }

          }

          • 2. Re: List of all the mbeans in jboss-as-7.1.0.Final
            ochaloup

            Hi,

            probably you already solved your problem but as a notice, you can find quite nice article about this on middlewaremagic.com: http://middlewaremagic.com/jboss/?p=1246