Home > Tomcat 6 > Taking Thread dumps on Tomcat on windows

Taking Thread dumps on Tomcat on windows

Hi All,

Sometime we start facing problems with Tomcat abrupt hang problem.The threads never go anywhere near the max.  The
CPU usage never goes above high usage.  The memory does not get used up. simply making the situation hang on server.

In that case only thing left with us is to analyse the thread dumps.  Taking thread dumps is very easy on windows using jstack command. Only thing we need to do is to take process id and fetch the thread dumps, By default all logs redirects to catalina.log but we can force the logs to some external files using dos command.

Follow the Below steps to fetch the Threads Dumps on Tomcat,

Step 1: Press the ctrl+alt+del(task manager) and get the Tomcat process id from running processes list. If PID is not coming then simply click on view->select columns -> select the PID(Process identifier).

Step 2: Open the command console and type the below command
jstack -l    e.g    jstack -l 2268

After that you will see the thread dumps on the Tomcat console itself. If you want to redirect the logs to some external file then use the below command.

jstack -l    e.g    jstack -l 2268 > c:\tomcat_threads.log (make sure this file should be created first)

——————————-

There is also one more workaround to fetch the same. Just set the focus on the tomcat console and press ctrl+break, you will see the same output on the console.

To read the Thread dumps, simply use the Samurai the one of best tool to analyse the thread dumps.
http://rocksolutions.wordpress.com/2010/04/01/reading-weblogic-thread-dumps-was-never-so-easy/

Hope this Helps.


Thanks
R Vashi

About these ads
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 68 other followers

%d bloggers like this: