Friday, March 20, 2009

Thread Dumps and WLST

you can read WLST output into a String, so instead of into a file you can redirect some commands into a String:

String connect = "connect('weblogic', 'weblogic', 't3://bcdev07:5210')";
WLST.ensureInterpreter();

WLSTInterpreter interpreter = WLST.getWLSTInterpreter();
interpreter.exec(connect);
while (true) {
OutputStream os = new ByteArrayOutputStream();
interpreter.setOut(os);
interpreter.exec("threadDump('false')");
System.out.println("buffer="  + os.toString());
TestingUtilities.sleep(100);
}



2 comments:

  1. Hi a little question, have ou tried using pwd()command?, I have tested a big list of commands but thar doesn' work, if you have a way or advice would be great.

    thanks in advance.

    ReplyDelete
  2. try this:

    WLSTInterpreter interpreter = WLST.getWLSTInterpreter();
    interpreter.exec(connect);
    interpreter.exec("serverRuntime()\n");
    while (true) {
    OutputStream os = new ByteArrayOutputStream();
    interpreter.setOut(os);

    interpreter.exec("myvar=pwd()");
    interpreter.exec("print myvar");

    System.out.println("buffer=" + os.toString());
    Thread.sleep(1000);
    }

    ReplyDelete

comments where you are promoting your business will be marked as SPAM :o)