Thursday, June 06, 2013

Remote Connection from VisualVM Through a Firewall

There's a lot of info on the web about how to use VisualVM to connect to a remote Java process, but if an awkward firewall is in the way this may come in handy... Set your suite of extra command line flags in the Java process to enable a remote connection, e.g.:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.local.only=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
Now use sshuttle to connect to the remote machine. Then in VisualVm connect to the port (in this example 9999) on localhost, and sshuttle will take care of the rest. Much easier than manual ssh tunnels or using jstatd and mucking about with security policy files. Of course the usual security implications of opening up ports an unauthenticated access apply.

0 Comments:

Post a Comment

<< Home