When running in a console window, pressing CTRL+Break signals the JVM to print out all stack traces of currently running threads.
If your application runs as a service (or linux/unix dæmon) you can’t press CTRL+Break, so you have to signal the JVM yourself to produce the stack trace. You can do that on linux by signaling a QUIT to the process, or by using jstack and the PID.
Good news, Java SE 6 on Windows comes with jstack. Yupee!
.
So next time you need a thread dump from a java application running as a service just get the pid, fire up a cmd and run jstack <pid>.
