Sunday, December 26, 2010

Collect Thread dump on windows


Step 1: Prepare a command to get Thread dump

java weblogic.Admin -url t3://localhost:7001 –username weblogic –password weblogic THREAD_DUMP

localhost - IP address of admin server

7001 - port number of admin server

Step 2: Open a command prompt and execute the above command

if you get ClassNotFoundException, it means the classpath is not properly set to call the java class weblogic.Admin,

Step 3: Set classpath to call weblogic.Admin

To set the classpath you can use -classpath variable and set the required JAR files or you can do the following,

Go to your weblogic domain and execute SetDomainEnv.cmd (for 9.2) or SetEnv.cmd (for 8.1) on the same command prompt.

Now the command prompt is ready to call the Java class weblogic.Admin and you can see the Threads details on the console (command prompt) of the weblogic server.

if you want to see the Thread dump on a file, you need to customize your startup script and redirect your logs to a file,

Step 4: Customize the weblogic startup script to redirect the logs

Commnad to start your weblogic server

%JAVA_HOME%\bin\java %JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -Dweblogic.Name=%SERVER_NAME% -Dweblogic.ProductionModeEnabled=%PRODUCTION_MODE% -Djava.security.policy="%WL_HOME%\server\lib\weblogic.policy" weblogic.Server >> console.log


Step 5:
You can see the thread dumps on weblogic console itself from 9.1 version,
If you using a weblogic 9.1, you can navigate to Server > Monitoring > Threads



Step 6: Get the output on the console




If you install your weblogic 8.1 as a service on windows machine then you can use beasvc to get thread dump, but its old procedure, now a days, thread dumps are available on console itself on weblogic 9.1 and 10.3

Please post your comments if you need more clarification.

2 comments:

Followers