jps returns no output even when java processes are running

后端 未结 6 889
粉色の甜心
粉色の甜心 2020-12-15 19:54

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 o

6条回答
  •  鱼传尺愫
    2020-12-15 20:33

    Make sure the program you are trying to 'detect' with jps (and jstack, incidentally) runs without setting the java.io.tmpdir setting, or setting it to the system default.

    There are a number of bugs on the Sun Developer Network temp dir locations should not be hardcoded, Fix for 6938627 breaks visualvm monitoring when -Djava.io.tmpdir and Make temporary directory use property java.io.tmpdir which are relevant here.

    The story: java Java 6 Update 22 used to use a hardcoded temporary directory for putting data gathered for use by jps and jstack. The jps and jstack programs knew where to look.

    However, because someone raised a 'bug' in Java 6 Update 23 they 'fixed' it to use the java.io.tmpdir java runtime setting instead. Now, this defaults to a system-specific location, which is what the 'hardcoded' one was. But if you set the option when invoking your java program, then it will use that instead. Result: jps and jstack look where they expect it to be and don't find anything.

    The solution is therefore to ensure that the java.io.tmpdir option is set to the system default (e.g., on the Mac:

    > java -Djava.io.tmpdir=$TMPDIR javamain
    

    )

    when invoking your program. Then jps and jstack will find it.

    My colleague Glyn Normington describes this on his blog. There is apparently a fix in Java 6 Update 25.

提交回复
热议问题