Can't debug Java Windows Services with jhat, jps, jstack
Posted
by Matthew McCullough
on Stack Overflow
See other posts from Stack Overflow
or by Matthew McCullough
Published on 2009-07-29T03:27:32Z
Indexed on
2010/03/28
21:03 UTC
Read the original article
Hit count: 471
I frequently showcase the jhat, jps, and jstack tool set to developers on Linux and Mac. However, a developer recently indicated that these are unusable in Windows if the Java app in question is running as a Windows Service.
A Sun-filed bug says something very similar, but was closed due to inactivity.
I have tested this out for myself, and indeed it appears true, though I can hardly believe it. Here is the setup:
- Tomcat or similar running as a Windows service with the "Log On As" == "Local System"
- A user with Admin privileges logged in to the same Windows machine.
- Admin opens Windows Task Manager, can see java.exe running
- Admin opens console, types "jps", gets back a list of processes that does not include Tomcat's java service process.
- As a brute force attempt, get the PID of tomcat as a service from Windows Task Manager. Type jstack < pid >. Get a reply: < pid > no such process
This appears reproducible under Windows XP, Windows 2003 Server, and Windows 7. Java versions 1.5 and 1.6 yield the same outcome.
Is there a way from the terminal, even though logged in as Admin, to "sudo up" to get JPS and the other tools to see the java service?
© Stack Overflow or respective owner