First, the problem description:
Ubuntu 10.10 version, the same JDK version 1.6, after booting Tomcat, using JPS cannot get the native Java process.
Second, JPS working principle:
1. When the Java process starts, if the-djava.io.tmpdir parameter is not specified, the new/tmp/hsperfdata_${user_name} file is created by default
2. JPS to scan the/tmp/hsperfdata_${user_name} file while querying the Java process
Third, the JPS can not work properly, may exist the reason:
1. Launch Tomcat with different versions of Java and JPS
2. JPS cannot read/tmp/hsperfdata_${user_name} file because of permissions issues
3. The Java process starts with the-djava.io.tmpdir parameter specified, that is, the default value is not used
Four, the problem positioning:
1. PS Query Java startup parameters
[Python]View Plaincopy
- Ps-ef | grep java | grep "Djava.io.tmpdir"
Discover that Tomcat does have a specified Djava.io.tmpdir parameter
2. Modify the Tomcat default catalina.sh file and modify the following
[Python]View Plaincopy
- If [-Z ' $CATALINA _tmpdir]; Then
- # Define The Java.io.tmpdir to use for Catalina
- Catalina_tmpdir=/tmp
- Fi
3. Restart Tomcat, re-execute JPS, problem resolution
JPS unable to get to the Tomcat (Java) process