Hi,

Jay SenSharma

Jay SenSharma

As we have seen many options to collect the Thread Dump of a Java Process specially in case of WebLogic. We have many options to collect the Thread Dumps as described in :   taking-thread-dumps/

Here we are going to see another additional option to collect the Thread Dump using “Jstack” utility which comes by default with Sun JDK 1.6 Onwards …It is easily down loadable as well. This utility can be seen inside the “<JAVA_HOME>/bin/jstack.exe”. Which requires the process ID (PID of any running Java process to collect and display the Thread Dumps.

NOTE: The “jstack.exe” which is available as part of JDK1.6 onwards…doesn’t have all the Options available inside it…Like  It doesn’t have

“-m” Option to generate the Thread Dump in Mixed mode. Means print native stack frames in addition to the Java stack.

“-F” Option to generate the Thread Dump Forcibly.

Step1). If you are using Unix Based Operating System then u can find out the Process ID (PID) by running the following Command:

ps -ef | grep java

OR

$JAVA_HOME/bin/jps -v

If you are using Windows then follow the below Steps to find out the Process ID (PID):

a) Press “Ctrl+Alt+Del” 2 buttons together.
b) Press the “Task Manager” Button
c) Click on “Processes” Tab.
d) Now Select the Menu Item “View” — > “Select Columns”
e) Check the “PID (Process Identifier)” Check box as well…
f) Now u can see the Process Id of “java.exe” in the “Processes” Tab.

Finding WLS Process ID in WINDOWS

Finding WLS Process ID in WINDOWS

Step2). Open a Command or Shell prompt and then Move inside the “%JAVA_HOME%/bin” directory and then run the “jstack.exe”  by passing the Process id of your Server Instance…

Syntax:

 jstack   -l   %PID%
Collecting Thread Dump Using JStack

Collecting Thread Dump Using JStack

.
.
Thanks
Jay SenSharma

If you enjoyed this post, please considerleaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.