Debugging JConsole Connection Failed
Make sure you are running your application with following java properties set
-Dcom.sun.management.jmxremote.port=9005 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
Try to connect now. If you want to debug this ,you can run the jconsole with following command
Below is the content of logging.properties file
Logging.properties handlers = java.util.logging.ConsoleHandler .level = INFO java.util.logging.ConsoleHandler.level = FINEST java.util.logging.ConsoleHandler.formatter = \ java.util.logging.SimpleFormatter // Use FINER or FINEST for javax.management.remote.level - FINEST is // very verbose... javax.management.level = FINEST javax.management.remote.level = FINER
Once you run
jconsole a separate window will pop up displaying logs.
if you run
jconsole -debug it gives you more diagnostic info on the failure. See
the Daniel Fuchs blog entry "Troubleshooting connection problems in JConsole".
I did this and it showed me I was using 32 bit jconsole the target process was started with a different (64 bit) jvm, so apparently this isn't allowed and it was thus failing.
This finally made it work for me : Giving this extra option:
-Djava.rmi.server.hostname=<ip addres where jvm is running
So all the vm arguments used to open jconsole from a remote machine, the jvm on the remote machine must be started with
-Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=<port> -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=<ip address>
The entire process is listed here