Tuesday, April 7, 2015

Different ways to take thread dumps in WebLogic Server

This article provides information about different ways on taking java thread dumps in a WebLogic Server environment. Thread dumps are essential diagnosis information used to analyze and troubleshoot performance related issues such as server hangs, deadlocks, slow running, idle or stuck applications, slow database interactions etc.

WebLogic Server (WLS) and Java offer several ways to generate thread dumps. It is always recommended to obtain the thread dumps by using operating system (OS) commands rather than by using Java classes or the Administration Console, because if the console is hanging, users won't be able to connect to it to issue thread dumps.

1. Using Weblogic WLST:
       setDomain.cmd or setDomain.sh depending on the OS
       java weblogic.WLST
       connect("<username>","<password>","t3://<url>:<port>")
       threadDump()

2. From a command line or shell, a thread dump can be generated via the following command.The Thread       dump will be generated in the defined server out.

      setDomain.cmd or setDomain.sh depending on the OS
      java weblogic.Admin <url>:<port> -username <username> -password <password> THREAD_DUMP

3. From weblogic console a thread dump can be created by navigating to
    Servers -> <server_name> -> Monitoring -> Threads -> Dump threads stack

4. Java VisualVM can also be used to take thread dumps while applications are running.
    See the link for more details: Thread Dumps via VisualVM

5. With jstack use below syntax to generate thread dumps.
     jstack <pid> or jstack -l <pid> to print additional information about locks

6. From the JRockit command line:
    jrcmd <pid> print_threads

7. From Java Mission Control with JDK 7:
    jcmd <pid> Thread.print

No comments:

Post a Comment