import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.naming.InitialContext;
.......
try {
MBeanServerConnection server = (MBeanServerConnection)new InitialContext().lookup("jmx/rmi/RMIAdaptor");
ObjectName on = new ObjectName("jboss.system:type=Server");
//Object ver = server.getAttribute(on, "VersionNumber");
Boolean started = (Boolean) server.getAttribute(on, "Started");
}
catch (Exception e) {
e.printStackTrace();
}
If the JBoss server is started, "started' will be "true"
References:
Comments