This question has been answered multiple times in Stackoverflow. However, I observe something, that is weird to me. As the title says, I'm unable to connect to a remote Java application from Java VisualVM from my laptop using JMX.
JVM Arguments used:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9701
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=170.76.90.68
Argument provided in "Add JMX Connection" dialogue box":
service:jmx:rmi:///jndi/rmi://170.76.90.68:9701/jmxrmi
I do see an 'established' connection in the remote server. That proves there is no firewall issue.
[09:45:59] dev@mx501:[/home/dex/bin]$ netstat -nap | grep :9701
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:9701 0.0.0.0:* LISTEN -
tcp 0 0 170.76.90.68:9701 10.119.136.76:59186 ESTABLISHED -
However, that 'established' connection goes away after some time and I get a typical exception in Java VisualVM, saying the connection could not be established.
[09:56:39] dev@mx501:[/home/dex/bin]$ netstat -nap | grep :9701
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:9701 0.0.0.0:* LISTEN -
[09:56:54] dev@mx501:[/home/dex/bin]$
Please help.