0 Replies Latest reply on Apr 17, 2012 9:49 AM by oa1611

    Accessing WebApplication Status through JMX

    oa1611

      Hello!

       

      I am trying to get the status of the deployed WebApplications on JBoss through JMX.

       

      I wrote a groovy code, but I am not seeing any JBoss MBean in my output.

       

      Just for testing I tried to print all MBeans where I defined the query as "*:*", and I was able to see 102 in total but non of them are from JBoss.  Not sure if I am doing something wrong in my code.

       

      import java.util.Set;
      import javax.management.MBeanServer;
      import javax.management.ObjectName
      import javax.management.j2ee.statistics.*
      import javax.management.remote.JMXConnectorFactory as JmxFactory
      import javax.management.remote.JMXServiceURL as JmxUrl
      def sb =''<<'';
      serverUrl="service:jmx:rmi://myserver/jndi/rmi://myserver:8686/jmxrmi"
      def server = JmxFactory.connect(new JmxUrl(serverUrl)).MBeanServerConnection
      def temp="";
      //query = "jboss.j2ee:*";
      query = "*:*";
      matches = server.queryNames( new ObjectName( query ), null );
      for (i in matches)
      {
      sb<<i.toString()<<"\n"
      }
      println("Total Mbeans= "+matches.size());
      println(sb);
      
      

       

      Thank you for your help.