Java Management Extensions (JMX) technology can be used to monitor and manage any Java technology-based applications (Java applications) that are running in either a local or a remote Java Virtual Machine (JVM). Java applications are automatically exposed for monitoring and management by JMX agents if they are run on the Java platform, Standard Edition (Java SE platform) version 6. If the Java applications are running on the Java 2 platform, Standard Edition (J2SE platform) 5.0, you can expose them manually for monitoring and management by setting the com.sun.management.jmxremote.* system properties when the applications are launched. Setting these system properties, or running your applications on version 6 of the Java SE platform, enables the platform's out-of-the-box monitoring and management capability, automatically enabling the platform MBean server in the JVM software, and registering MBeans in it that expose the application for management by any appropriately configured JMX client application. VisualVM is one such JMX client application.
NOTE: For a very brief introduction to JMX technology, MBeans, the platform MBean server, and how to monitor and manage MBeans using Java VisualVM, see the Java VisualVM MBeans Tab page. For an introduction to the Java SE platform's out-of-the-box monitoring and management capability, see Monitoring and Management Using JMX Technology in the Java SE Platform Monitoring and Management Guide.
As stated above, Java VisualVM will automatically detect and connect to Java applications that are running on version 6 of the Java SE platform or that have been started with the correct system properties on version 5.0. However, because there are cases in which Java VisualVM cannot automatically discover and connect to JMX agents that are running in a target Java application, a means of creating explicit JMX connections has also been added to Java VisualVM.
The circumstances in which Java VisualVM will not automatically discover JMX agents, and thus the Java applications they expose, are the following:
Before you can make an explicit JMX connection from Java VisualVM to a running application, this application must be started with the correct system properties. The system properties in question are the following:
com.sun.management.jmxremote.port, to specify the port number through which the application will be exposed
com.sun.management.jmxremote.ssl, to specify whether secure sockets layer (SSL) encryption will be activated to secure the connection to the application
com.sun.management.jmxremote.authenticate, to specify whether the connection will be password protected
This section shows an example of how to connect Java VisualVM to a local application via an explicit JMX connection.
java -Dcom.sun.management.jmxremote.port=3333 \ -Dcom.sun.management.jmxremote.ssl=false \ -Dcom.sun.management.jmxremote.authenticate=false \ YourJavaAppIn the command above, YourJavaApp is launched with the Java SE platform's out-of-the-box monitoring and management capability configured as follows:
The host name localhost is already filled in. You only need to add the port number on which the application is exposed for monitoring and management.
You can also make explicit JMX connections to applications running on remote hosts, as explained below:
If you know that the JMX agent has been protected with a
username and password, enter them in the Add JMX Connection dialog
and specify whether you want the credentials to be saved so
that when Java VisualVM restarts it will silently reconnect to the JMX agent without prompting the user for the security credentials again.
For more information about JMX technology and monitoring and management of the Java SE platform, see the following documents.