It is very annoying when you see JConsole failed to attach to a runtime with simply tells you “The connection to pid did not succeed. Would you like to try again?”. This is a completely useless message.
How to troubleshooting JConsole connection failure? You can start it with option
And the logging.properties file should look like
//Log level is the level of java.util.logging.Level
//It can be SEVERE, WARNING, INFO, CONFIG, FINE, FINER or FINEST
handlers = java.util.logging.ConsoleHandler
.level = INFO
java.util.logging.ConsoleHandler.level = FINEST
java.util.logging.ConsoleHandler.formatter = \
javax.management.level = FINEST
javax.management.remote.level = FINER
With this, you will see a separated log dialog popped out when you start Jconsole and it will print out more information about the failure.