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

Accessing WebApplication Status through JMX

oa1611 Newbie



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 =''<<'';
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)
println("Total Mbeans= "+matches.size());


Thank you for your help.