How to - Generate Thread dump automatically in websphere

A javacore, or thread dump  is needed in order to determine the potentially hung threads.
there are two ways

1) Via Admin console

 Set the com.ibm.websphere.threadmonitor.dump.java property to true:


Application Servers:
From the administrative console, click Servers > Application Servers > server_name.
Under Server Infrastructure, click Administration > Custom Properties.
Click New and add the following property:

Name: com.ibm.websphere.threadmonitor.dump.java
Value: true
Click Apply.
Click OK and save the configuration changes.
Restart the Application Server for the changes to take effect.
Node Agent:
From the administrative console, click System Administration > Node Agents > nodeagent.
Under Additional Properties, click Administration Services
Under Additional Properties, click Custom Properties
Click New and add the following property:

Name: com.ibm.websphere.threadmonitor.dump.java
Value: true
Click Apply.
Click OK and save the configuration changes.
Restart the Node Agent for the changes to take effect.


After the restart , when ever your application encounters a hung thread i.e ( WSVR0605W message is written out to the SystemOut.log file) it will generate the dumps.

Note: - i usually would not recommend doing it since taking thread dumps may alter the performance of the application or consume high CPU.


2) Another way is a force full way - we can  take the thread dumps with command line.

Go to websphere directory
example: - D:\Program Files\IBM\WebSphere\ProcServer\profiles\wprcs_profile\bin

and open up wasadmin.bat file
enter the username and password of WAS


then run these commands to grab the thrad dumps
1) wsadmin>set jvm [$AdminControl completeObjectName type=JVM,process=server1,*]

example:  - wsadmin>set jvm [$AdminControl completeObjectName type=JVM,process=App.BSpaceCluster.BSpaceMember,*]

App.BSpaceCluster.BSpaceMember : - this is my Server1 ( you can find it from the console)


2) wsadmin>$AdminControl invoke $jvm dumpThreads



Run both the commands atleast three/four time in duration of 15 seconds.


 Look for an output file, in the installation root directory for the product, with a name like 'javacore.date.time.id.txt'.

Post a Comment

0 Comments