When running Java based application servers such as JBoss or Tomcat it is essential to monitor the status of the process – it’s memory consumption, threads and so on. In order to do that, Sun had introduced the JConsole application in Java 5, and now we have its successor visualvm.
In order to monitor the java process, you need to add the following system properties to the command line:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false
In the visualvm you just use the connection string
However, sometimes the RMI listener listens to the wrong IP address, one which is inaccessible to the visualvm. Thanks to Pavel’s tip, I found a way to overcome this is by adding the following parameters:
Now it works like a charm!
For completeness, I’d mention you can secure the connection to the JVM, either by requiring user/password or by using SSL. If you are interested, please see this guide.