Friday, September 2, 2011

jps can not detect the tomcat process? not a problem!

Before going any further, first thing you need to do is to check and see what version of jdk is being used by tomcat. Is it Java 6 Update 23 or Java 6 Update 24? you are at the right place

Why this problem?
some bug in jvm. I would not go into details. if you are interested please look at below links

https://issues.apache.org/bugzilla/show_bug.cgi?id=50518
http://stackoverflow.com/questions/6287926/jps-not-showing-tomcat-process

 How to fix it?

Solution 1
Use any other version than the above mentioned ones

Solution 2
If, for some reason, you have to keep the same version. do below.
  1. Find where tomcat is saving the monitoring related data.
    This normally gets saved at $java.io.tmpdir. Easy way to figure out is to search for directories starting with hsperf* on your machine.
    some thing like below would work on linux.
    $find / -name hsperf*
  2. lets say it is found at /tmp/tomcat6_tmp/hsperfdata_root
    $jps -J-Djava.io.tmpdir= /tmp/tomcat6_tmp
  3. For any other jvm monitoring tool to work, the tool needs to know where the above found file is. for example for jstat to give details about your tomcat process (lets say processid/vmid is 12345..)
    $jstat -gc 12345 -J-Djava.io.tmpdir=/tmp/tomcat6_tmp


Happy monitoring...

No comments:

Post a Comment

Followers