Or, may be you monitored your tomcat server remotely using this type of URI in jconsole
'service:jmx:rmi:///jndi/rmi://server:9024/jmxrmi'
Now, its time to do the same for the Java application you have written.
The idea to expose your platform MBean server through RMI
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
// expose the MBean server through a service URL.
JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9999/server");
JMXConnectorServer cs = JMXConnectorServerFactory.newJMXConnectorServer(url, null,mbs);
cs.start();
Ohh.. you have to open an RMI registry at port 9999, for sure.
rmiregistry 9999
Now, what are the benefits are you having monitoring remotely?
- First of all, using jconsole, jvisualvm can be a big performance issue for the application you are running on the same machine. Moreover, you production server is an Ubuntu server, so you cannot run Jconsole.
No comments:
Post a Comment