0

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 myuser@1.11.11.111

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.

enter image description here

If I click on "Insecure connection" I get

enter image description here

How can I get around this?

Javide
  • 2,477
  • 5
  • 45
  • 61

1 Answers1

1

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
Javide
  • 2,477
  • 5
  • 45
  • 61