This section provides a tutorial example on how to turn on the out-of-the-box JMX agent on Sun JVM for monitoring tool 'jconsole' to connect from remote machines.
If you want to run 'jconsole' on a remote machine to monitor a Java application,
you need to launch the JVM with the default JMX agent turned on using this system property:
"com.sun.management.jmxremote.port=<portNum>"
Here is what I did to run my PrimeNumberSeeker.java with the default JMX agent for remote
monitoring connections:
1. To run this program with the out-of-the-box JMX agent turned on, I used the following commands:
2. I got this error because the remote JMX agent requires a password file
to only give permissions to authorized remote connections. For testing purpose,
I used this system property: "com.sun.management.jmxremote.authenticate=false"
to turn off the authentication function:
3. I tried to run "jconsole localhost:6789" to connect to this JMX agent remotely.
But the connection failed with this error dialog box:
4. The connection failed because the remote JMX agent also requires a SSL client certificate.
For testing purpose, I used this system property: "com.sun.management.jmxremote.ssl=false"
to turn off the SSL function: