Unable to connect to remote JMX using VisualVM but OK with JConsole

3.4k views Asked by At

I'm attempting to connect to a remote JMX service using VisualVM 1.3.8 with JRE 1.8.0. Making exactly the same connection with JConsole works perfectly, however the attempt to use the same parameters with VVM just hangs at the 'Adding services' stage. I've looked in the VVM log but there is literally nothing logged.

I also read here at the VVM remote JMX doc:

Note: To retrieve and display information on applications running on the remote host, the jstatd utility needs to be running on the remote host.

That puzzles me since I can make the remote JMX connection using JConsole and as far as I can tell, jstatd is not running on the remote.

Does anyone know if jstatd a requirement only for VVM as a remote JMX client? As the JMX connection can be made with JConsole between the same client and server endpoints, then there's no problem with network/firewall etc.

Other than that I'm really puzzled where else to look for clues?

1

There are 1 answers

1
bsravanin On

I had the same trouble when I switched from Java 7 to 8, while using SOCKS where I was updating proxy settings through VisualVM -> Tools -> Plugins -> Settings -> Proxy Settings. However, I have been successful with the following:

  1. Run your JVM with the following options:

-Dcom.sun.management.jmxremote.port=<JMX_PORT> -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false

Note that you could obviously do something more secure, both w.r.t SSL and authentication.

  1. Setup a SOCKS proxy from your localhost to the remote server:

ssh -D<SOCKS_PORT> -vvv -N <REMOTE_HOST>

  1. Run either of these commands on your localhost:

jconsole -J-DsocksProxyHost=localhost -J-DsocksProxyPort=<SOCKS_PORT> service:jmx:rmi:///jndi/rmi://<REMOTE_HOST:JMX_PORT>/jmxrmi jvisualvm -J-DsocksProxyHost=localhost -J-DsocksProxyPort=<SOCKS_PORT> --openjmx <REMOTE_HOST>