The JMX subsystem sets up a JMX connector so that invocations can be done on the JMX MBean server from outside the JVM
<subsystem xmlns="urn:jboss:domain:jmx:1.0">
<jmx-connector registry-binding="jmx-connector-registry"
server-binding="jmx-connector-server"/>
</subsystem>
...
<socket-binding-group name="standard-sockets" default-interface="public">
...
<socket-binding name="jmx-connector-registry" port="1090"/>
<socket-binding name="jmx-connector-server" port="1091"/>
...
</socket-binding-group>
To use the connector you can access it in the standard way:
import javax.management.MBeanServerConnection;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
public class JMXExample {
public static void main(String[] args) throws Exception {
//Get a connection to the JBoss AS MBean server on localhost
String host = "localhost";
int port = 1090;
String urlString = System.getProperty("jmx.service.url",
"service:jmx:rmi:///jndi/rmi://" + host + ":" + port + "/jmxrmi");
JMXServiceURL serviceURL = new JMXServiceURL(urlString);
JMXConnector jmxConnector = JMXConnectorFactory.connect(serviceURL, null);
MBeanServerConnection connection = jmxConnector.getMBeanServerConnection();
//Invoke on the JBoss AS MBean server
int count = connection.getMBeanCount();
System.out.println(count);
}
}
You can also connect using jconsole. In addition to the standard JVM MBeans, the JBoss AS 7 MBean server contains the following MBeans:
JMX ObjectName
|
Description
|
jboss.msc:type=container,name=jboss-as
|
Exposes management operations on the JBoss Modular Service Container, which is the dependency injection framework at the heart of JBoss AS 7. It is useful for debugging dependency problems, for example if you are integrating your own subsystems, as it exposes operations to dump all services and their current states
|
jboss.naming:type=JNDIView
|
Shows what is bound in JNDI
|
jboss.modules:type=ModuleLoader,name=*
|
This collection of MBeans exposes management operations on JBoss Modules classloading layer. It is useful for debugging dependency problems arising from missing module dependencies
|