How to obtain a Java Thread Dump on a Windows server

If your Asset Bank becomes unresponsive then our support staff may ask for you to perform a thread dump so that we can analyse the results to diagnose the problem. This article explains how to take a Java thread dump.

If you have a Tomcat Properties icon in your system tray on the server (as shown above) the process is quite easy.

Right-click on the Tomcat Properties icon and select 'Thread Dump' from the options. This will output a thread dump to one of the log files in your [Tomcat Home]\logs directory. Send us all of the log files.

If you do not have the Tomcat Properties icon in your system tray then the process is a little more advanced:

1. Download psexec from this website.

2. Unzip the 'PSTools' directory to a suitable place on your server.

3. Open the unzipped 'PSTools' folder, hold shift and right-click inside it, then select 'Open command window here' (if you don't have the 'Open command window here' option you can run a command prompt as Administrator and navigate to the location of the PSTools folder using the command prompt)

4. Open Task Manager > Services and find your Java (Tomcat) service and note down the PID number.

5. At the command prompt type 'psexec -s jstack XXXX > thread_dump_ddmmyy.log' (where XXXX is your PID and ddmmyy is the current date to append to the name of the log file) then hit enter. You should now have a file named thread_dump_ddmmyy.log in the PSTools folder. This is the file you should send us.


If you find you get an error saying 'jstack is not a recognised command' (or similar) then you can solve this by one of two options:

1. Use the full path to jstack in the command (e.g. 'psexec -s "C:\Program Files\Java\jdk1.6.0_22\bin\jstack.exe" XXXX > thread_dump_ddmmyy.log')

2. Add the full path of your Java 'bin' directory to the server's system path variable. The Java 'bin' directory is usually in 'Program Files\Java\bin\jdk<version>\bin'. If you add this path to the system variable then you will need to restart the command prompt again for the change to be picked up and the 'jstack' command to work.

Was this article helpful?

Yes No

Thanks for your feedback!