The
Jconsole is a graphical tool introduced from Java 5 to monitor JVM performance and resource consumption. The
Jconsole can connect to a local Java program or to a remote Java program. Because it is the way to use the GUI, so do not dwell on those basic methods of use, here is only a record of the trial process encountered several small problems and solutions. The
uses Java in the SPECjbb2005 this benchmark to do the experiment because it is also a Java application benchmark that can be used in run.sh scripts to "java_options= "This line is tailored accordingly.
1. To enable Jconsole to connect remotely to a Java program, you need to add the option "com.sun.management.jmxremote.port=8888" in the Java program launch java_option To specify a remote-managed port.
2. When you start the Java program, you get the following error:
The code is as follows |
Copy Code |
[Root@localhost specjbb2005]#./run.sh Thu June 23:00:50 CST 2013
./jbb.jar:./check.jar: Java full version "1.6.0_24-b24" Error:password file not found:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/management/ Jmxremote.password Thu June 23:00:50 CST 2013 |
This is because the Java JMX Remote management, the default will be the user name password authentication, so need the appropriate password file.
code is as follows |
copy code |
[Root@localhos T specjbb2005]# ls/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/management/ jmxremote.access jmxremote.password.template management.properties snmp.acl.template |
The
needs to first define user rights in Jmxremote.access, and then define the user name and corresponding password in the Jmxremote.password file, Jmxremote.password files can be copied jmxremote.password.t Emplate the template file for modification.
Of course, in the Intranet only for debugging, we generally can not set the password authentication and SSL connection, the Java option is as follows:
-dcom.sun.management.jmxremote.authenticate=false- Dcom.sun.management.jmxremote.ssl=false
3. After the port and authentication information has been configured, it is found that the JVM is still not successful in Jconsole through IP remote connection. The
error message is: Connection failed:retry? The connection to 192.168.52.11:8888 did is not succeed. Would to try again?
When you start Java, you need to set the host name of the RMI remote call, typically set to the IP address of the host, as follows:
-djava.rmi.server.hostname=192.168.52.11
(of course, It is also possible that the SSL setup problem mentioned in the previous 2nd will still need to be checked.
about Jconsole, or to perform a look at Oracle's description of the jconsole in Java SE 6:
http:// Docs.oracle.com/javase/6/docs/technotes/guides/management/jconsole.html
(especially in the above document for monitoring data, graphical representation of the meaning of the need to be carefully understood)