Run A Java Process to Listen to JVisualVM Requests from Other Hosts
Updated 28 Jan 2015
Let's say you have a Java program, testjmx.TestIt, on your machine that has IP address 192.168.1.148. Run it like so:
mwood@workstation:~/workspace/testjmx/bin$ java \ -Dcom.sun.management.jmxremote.port=1234 \ -Dcom.sun.management.jmxremote.authenticate=false \ -Dcom.sun.management.jmxremote.ssl=false \ -Djava.rmi.server.hostname=192.168.1.148 \ testjmx.TestIt
The first three defines are well-documented; the last define, where you spell out to RMI what host it's runing on, is not very well documented, but there's a note about it here:
http://blogs.sun.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole
The hostname that you define in the java.rmi.server.hostname
system property must match exactly the
hostname you use when connecting from JVisualVM.
Then, on another machine, just do this:
mwood@laptop:~$ jvisualvm
Add a new JMX connection to localhost:1234
, then find that new connection in the left-hand
pane, and double-click on it to start monitoring.