Using VisualVM, there are two types I can see to connect remote host.
jstatd
JMX
So I am trying to use JMX, I followed numerous tutorials but no luck so far.
Currently, there's my desktop and one linux box with java server application running. I am trying to setup VisualVM client on desktop to see java application running on the linux box.
I added following JAVA_OPTS script on start.sh script for the java application on linux.
JMX_PORT="-Dcom.sun.management.jmxremote.port=33333" <-- allowed on firewall
JMX_SSL="-Dcom.sun.management.jmxremote.ssl=false"
JMX_AUTH="-Dcom.sun.management.jmxremote.authenticate=false"
JMX_IP="-Djava.rmi.server.hostname=xx.xx.xx.xx" <-- where linux box NAT ip.
Java application on linux was successfully started with jmx options added start.sh, I assume since there's no error or warning.
When I tried to add JMX connection, it says it can't connect to it.
I checked if 33333 is blocked, it's not, I was able to connect to that ip with port using telnet from my desktop.
Is there any other port that I should open for VisualVM?
To use JMX, is there any other setup that I have to do such as RMI Registry server or jstatd policy file creation and start jstat daemon?? I thought it was for jstatd connection only so I didn't pursue that tutorial.
I had no other clue how I can fix this so ended up using ssh tunnel.
Now remote host is successfully added using add new jmx connection on VisualVm.
ref. VisualVM over ssh