How to Generate
the Thread Dump
I have explained
“Thread Dump” in my blog post. Today I will try to explain t about how to
generate the thread dump on “Linux”, “Unix” and “Windows” machine.
Let’s go
to Windows server.
There are
various methods to do this. Below is one of them:
1.
Go to
the bin folder of JDK (e.g. C:\Program Files\Java\jdk1.8.0_131\bin)
2.
Launch
JVisualVM by clicking “jvisualvm.exe”
3.
Java
VisualVM tool will be launched
4.
Right-click
on the java process appears under ‘Local’
5.
Click
“Thread Dump”. The thread dump will be generated and open in the right pane for
analysis.
Generate Thread Dump on Linux Server:
1.
Use “ps
-ef | grep java” to get java process ID.
2.
Use
“kill -SIGQUIT” command along with PID.
Generate Thread Dump on Unix Server:
1.
Before
generating the thread dump you must know the Java process ID running on the
server.
The Java
processID (PID) can get using “jps” command in Unix server.
e.g. 54342 is a processID (PID) of
NMSDaemon java thread
Hopefully this post would be helpful.
Hopefully this post would be helpful.
2. View
thread dump using “jstack <PID>” command.
3. We
can save the thread dump in a file then use “jstack -l <PID> >
<file path and name>“
Note:
1.
The
‘jstack’ tool is included in JDK since Java 5.
2.
If we
are running the application in tomcat, thread dump will be sent into
<TOMCAT_HOME>/logs/catalina.out file.
Happy
Testing!!!
Comments
Post a Comment