Hi,

Jay SenSharma

Jay SenSharma

Out of various ways described in the following link to Collect THREAD DUMPS “taking-thread-dumps/” .

Here is another option available which can be used to collect The Thread Dump remotely. This can be achieved using “weblogic.common.T3ServicesDef” and “weblogic.common.AdminServicesDef”  weblogic APIs.

To achieve it we need to simply run “. ./setWLSEnv.sh” and then simply need to run the following program:

“T3ServiceTestClient.java”

import javax.naming.*;
import java.util.*;
import weblogic.common.*;
import weblogic.io.common.*;
public class T3ServiceTestClient
{

public void takeThreadDump(T3ServicesDef t3ServicesDef)throws Exception
{
t3ServicesDef.admin().threadDump();
}


public static void main(String ar[]) throws Exception
{
T3ServicesDef t3services;
Hashtable env = new Hashtable();
env.put(Context.PROVIDER_URL, "t3://localhost:7003");
// Above line u can pass any Managed Server URL as well to take their Thread Dumps//
env.put(Context.INITIAL_CONTEXT_FACTORY,weblogic.jndi.WLInitialContextFactory.class.getName());
env.put(Context.SECURITY_PRINCIPAL, "weblogic");
env.put(Context.SECURITY_CREDENTIALS, "weblogic");

Context ctx = new InitialContext(env);
t3services = (T3ServicesDef)ctx.lookup("weblogic.common.T3Services");
System.out.println("nt For the T3ServicesDef : "+t3services);

T3ServiceTestClient client=new T3ServiceTestClient();
client.takeThreadDump(t3services);
}
}

As soon as you run the above program you will see that the Thread Dump is generated in the Server STDOUT.

.

.

Thanks

Jay SenSharma

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.