Collect thread dumps while running java process in background
Thread dumps are vital information to debug the application response slow issue and know the server status. If Pramati Server is running as a background process (Service) in Windows, it is very difficult to collect thread dumps. To overcome this problem, use one of the following third party tools:
1. StackTrace tool developed by adaptj
2. SendSignal program
1. StackTrace is a tool developed by adaptj for inspecting the state of a running JVM without starting it in debug mode and without using any additional startup settings. Visit the following link to download the same:
http://www.adaptj.com/root/main/download
* Now, click on “Launch” button and save the “launch.jnlp” file in the local system.
* Once the launch.jnlp file has been downloaded successfully, double click on the lanuch.jnlp file to execute. Please note that this jnlp file requires Internet connection during the execution.
* Upon the startup, it opens a new window with the title of “Stack Trace-Untitled”.
* In the opened window, provide “Process ID” (Pramati Server’s java process id located in task manager) in the textbox.
* Now, select “Process” tab and then choose “Thread dump” option.
* Upon the selection, it will generates the thread dumps in that tool itself.
2. SendSignal is a tool which sends ctrl-break signal from command line to JVM to generate thread dumps. Visit the following link to download the same:
http://www.latenighthacking.com/projects/2003/sendSignal/SendSignal.exe
* Once you have downloaded SendSignal.exe program from the above mentioned link, open a command prompt and navigate to the directory where you have downloaded this program.
* Increase the screen buffer(right click on the left top corner of the command window–>Properties–>Layout–>Increase the screen buffer height to 9999) size to capture complete thread dumps.
* Now, Execute the following command:
SendSignal <$PID>
Where PID is the java process id related to Pramati Server. We will get this from task manager.
* This command will generate the thread dumps on the command prompt.

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

dBS8Qi Excellent article, I will take note. Many thanks for the story!