Obtaining a Java Thread Dump under WebSphere 5 or above

(From http://www-1.ibm.com/support/docview.wss?rs=2026&context=SSCPX3&dc=DB520&uid=swg21177139&loc=en_US&cs=UTF-8&lang=en)

In case of a server hang

# In the case of a server hang, you can force an application to create a thread dump (or javacore). Once again, this is different from WebSphere 4:

1. Using the wsadmin command prompt, get a handle to the problem application server:
    wsadmin>set jvm [$AdminControl completeObjectName type=JVM,process=server1,*]

2. Generate the thread dump:
    wsadmin>$AdminControl invoke $jvm dumpThreads

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

Using the Thread Dump

Once you have the thread dump, you can forward it to Tech Support and also browse it for clues. Here are some tips:


If the JVM creates the thread dump as it closes (the thread dump is not manually forced), there might be "error" or "exception information" strings at the beginning of the file. These strings indicate which thread caused the application server to die.
The thread dump contains a snapshot of each thread in the process, starting in the section labeled "Full thread dump."
Look for threads with a description that contains "state:R". Such threads are active and running when the dump is forced, or the process exited.
Look for multiple threads in the same Java application code source location. Multiple threads from the same location might indicate a deadlock condition (multiple threads waiting on a monitor) or an infinite loop, and help identify the application code with the problem. 
 

你可能感兴趣的:(java,jvm,thread,IBM,websphere)