I have a Java 8 application running on a remote Linux server and need to attach a JConsole to it for debugging purposes.
From my local machine I set up a tunnel to the remote machine:
ssh -fN -L 9999:localhost:9999 [email protected]
On the remote machine I run the application with the following system properties:
java -Dcom.sun.management.jmxremote.port=9999 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.local.only=false \
-cp foo.jar:config com.foo.bar.Main config/blah.properties
but when I start the JConsole I get Secure connection failed.
If I click on "Insecure connection" I get
How can I get around this?
I managed to make it working adding an extra system property for the RMI port:
java \
-Dcom.sun.management.jmxremote.port=9999 \
-Dcom.sun.management.jmxremote.rmi.port=9999 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.local.only=false \
-cp foo.jar:config com.foo.bar.Main config/blah.properties