Tomcat troubleshooting – Thread Stack Trace

One of the best troubleshooting tools when using tomcat is to cause the JVM to print a thread stack trace for each current thread. This will provide insight into what all threads are currently doing.

Note that if you wait until there is a problem to take the first stack trace, it will be very difficult to solve any problems. Take a look now and see what the current behavior is so that it will be easier to troubleshoot later.

To get a thread stack trace, use the following command:

sudo -u tomcat jstack PID > /tmp/$(date +%Y%m%d)-jvm-thread-stack.txt

Leave a Reply

Your email address will not be published. Required fields are marked *