The service URL is of this form
service:jmx:rmi:///jndi/rmi://localhost:9900/jmxrmi
| InitialContext ctx = new InitialContext();
| MBeanServerConnection server = (MBeanServerConnection)
ctx.lookup("jmx/invoker/RMIAdaptor");
| System.out.println(server);
| System.out.println("Total MBeans " + server.getMBeanCount());
|
|
| JMXServiceURL url = new
JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9900/jmxrmi");
| JMXConnector connector = JMXConnectorFactory.connect(url);
| MBeanServerConnection connection = connector.getMBeanServerConnection();
| System.out.println(connection.getMBeanCount());
|
The top bit as well as bottom bit both do similar things.
However for JMX serviceURL you need to provide the port number to listen to. Note 1099 is
RMI, the one below is JRMP
set JAVA_OPTS=%JAVA_OPTS% "-Dcom.sun.management.jmxremote.port=9900"
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4174495#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...