I would like to monitor a remotely running java (spring boot) application with jvisualvm (or jconsole). When running locally, I can see the managed beans in both jvisualvm and
Arnab Biswas's anwser not work in my case. After an hour of researching, I found out that JMX runs on top of RMI, and as such, there are 2 ports that JMX utilizes:
-Dcom.sun.management.jmxremote.port
)-Dcom.sun.management.jmxremote.rmi.port
)RMI data port will open a random port start from 1099
. By setting the port used by the RMI registry and the RMI server to the same port, tunneling will be much easier.
So I need to add -Dcom.sun.management.jmxremote.rmi.port=9010
to JVM options
And I need to use the following JVM options :
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9010 -Dcom.sun.management.jmxremote.rmi.port=9010 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=192.168.59.99
Read more: