Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jps returns no output even when java processes are running

I'm trying to debug some issues with java processes on a Solaris box, but running jps returns no output. And jstack gives the error 'Permission denied'. The box is part of a cluster of 3 identical servers, jps and jstack work fine on the 2 other servers.

I found the following forum post from someone with the same problem but no answers: http://forums.sun.com/thread.jspa?threadID=5422237

To clarify running bps and grep for java gives all java proceses correctly, but jps gives nothing (anonymised with 'program' and 'client' to protect the guilty):

program @ clientdelivery2 : ~/
-> bps auxww|grep java
program     3427  5.5 54.067742726649544 ?        S   Sep 25 1039:47 /usr/jdk/instances/jdk1.6.0_16/bin/amd64/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/app/client/program/tomcat/conf/logging.properties -Xmx6144m -XX:PermSize=128m -XX:MaxPermSize=512m -Djava.endorsed.dirs=/app/client/program/tomcat/endorsed -classpath :/app/client/program/tomcat/bin/bootstrap.jar -Dcatalina.base=/app/client/program/tomcat -Dcatalina.home=/app/client/program/tomcat -Djava.io.tmpdir=/app/client/program/tomcat/temp org.apache.catalina.startup.Bootstrap start
program    29915  0.1 11.915252441467896 ?        S 14:55:28  3:59 /usr/jdk/instances/jdk1.6.0_16/bin/amd64/java -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=/app/clientclone/program/tomcat/conf/logging.properties -Xmx2g -XX:PermSize=128m -XX:MaxPermSize=512m -Dcom.sun.management.jmxremote -Djava.endorsed.dirs=/app/clientclone/program/tomcat/endorsed -classpath :/app/clientclone/program/tomcat/bin/bootstrap.jar -Dcatalina.base=/app/clientclone/program/tomcat -Dcatalina.home=/app/clientclone/program/tomcat -Djava.io.tmpdir=/app/clientclone/program/tomcat/temp org.apache.catalina.startup.Bootstrap start
program     1573  0.0  0.0 4760 1332 pts/5    S 17:05:24  0:00 grep --colour java

program @ clientdelivery2 : ~/
-> jps

program @ clientdelivery2 : ~/
->

I asked around and from here http://forums.oracle.com/forums/message.jspa?messageID=5408592 I've got that the issue is:

12460/2: mkdir("/tmp/hsperfdata_program", 0755) Err#13 EACCES [ALL]

Meaning jps is being denied access to the psperfdata directory.

Has anyone run into this issue and know how to solve it?

like image 213
Sindri Traustason Avatar asked Sep 27 '10 15:09

Sindri Traustason


People also ask

What is JPS command in Java?

The jps command uses the java launcher to find the class name and arguments passed to the main method. If the target JVM is started with a custom launcher, the class name (or JAR file name) and the arguments to the main method will not be available.

How do I check if a Java process is running in Linux?

On Linux, you can view processes with the ps command. It is the simplest way to view the running processes on your system. You can use the ps command to view running Java processes on a system also by piping output to grep . OpenJDK, however, has its very own specific process monitor.

How do you check if a process is running in Windows using Java?

If you want to check the work of java application, run 'ps' command with '-ef' options, that will show you not only the command, time and PID of all the running processes, but also the full listing, which contains necessary information about the file that is being executed and program parameters.


2 Answers

Turns out the user didn't have access to /tmp because of some issue with mounting the file system. This leads to the files inside hsperfdata_ to never be written, even though the user had access to the /tmp/hsperfdata_ folder itself.

like image 168
Sindri Traustason Avatar answered Oct 11 '22 15:10

Sindri Traustason


tldr: sudo jps worked for me (for reasons invoked in other answers)

like image 28
Thomas Avatar answered Oct 11 '22 14:10

Thomas