Tuesday, February 16, 2010

Thread dumps using Commandline

Generic approach would be kill -3 on any unix/linux box ,output would be in std_out file. What if you need to take 4 or 5 thread dumps and std_out file is so huge that you need to use your unix skills to extract those thread dump output from this logs .

You can use the following methods for taking the threaddumps from commandline

#############
Jboss
#############

/jboss/bin/twiddle.sh invoke "jboss.system:type=ServerInfo" listThreadDump > /tmp/threadump.out


#############
Weblogic
#############

1. Source the environment variable.

Example: source /opt/bea/10.0/user_projects/domains/supportapps/bin/setDomainEnv.sh

2. Invoke wlst with following command and connect to the admin server in offline mode

$ java weblogic.WLST

connect ('Admin_Console_user_id','Password','t3://console_url')


Example:
connect ('weblogic','weblogic','t3://supportapps.blogspot.com:7001')

3. Take Thread Dump

threadDump('true', 'file name', 'server_name')

Example:
threadDump('true', 'supportapps.out', 'server1')

#############
Websphere
#############
Generating thread dump/java core using WSAdmin prompt .You can generate Thread Dump or Java core manually using the following

WSAdmin prompt

Using wasadmin prompt,

wsadmin >

set objectName [$AdminControl queryNames WebSphere:type=JVM,process=server1,node=appsrv01_node,*]

$AdminControl invoke $objectName generateHeapDump

$AdminControl invoke $objectName dumpThreads



Once the thread dump is generated you can find out the location of the thread dump from native_stderr.log file. This is

sample of the messages from my native_stderr.log


JVMDUMP007I JVM Requesting Java Dump using '/opt/AppServer/profiles/AppSrv01/javacore.20090705.212408.5480.0001.txt'
JVMDUMP010I Java Dump written to /opt/AppServer/profiles/AppSrv01/javacore.20090705.212408.5480.0001.txt



No comments:

Post a Comment