Why should I forgo my Eclipse IDE, with remote debugger, autocomplete, etc to use an unstable Dynamic language which fails without a warning?
So for complex code involving Weblogic tasks, here is how you can generate and run Python statememts withing Java code:
package com.pierre.wlst; import weblogic.management.scripting.WLST; import weblogic.management.scripting.utils.WLSTInterpreter; public class WLSTWrapper { public static void main(String[] args) { WLSTWrapper wrapper = new WLSTWrapper(); wrapper. doSomething(); } public void doSomething() { WLST.ensureInterpreter(); WLSTInterpreter interpreter = WLST.getWLSTInterpreter(); interpreter.exec("connect('weblogic', 'weblogic', 'localhost:7001')"); interpreter.exec("ls()"); } }
2 comments:
thanks for straight example to connect weblogic server using wlst in java.
Cheers,
agus w
thank for your topic,
but i'm having a prolem about getting Role from java when using wlst.
my code following:
------------------------------------------
import weblogic.management.scripting.utils.WLSTInterpreter;
import weblogic.management.scripting.WLST;
public class JavaTestWLST {
public JavaTestWLST() {
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
WLST.ensureInterpreter();
WLSTInterpreter interpreter = WLST.getWLSTInterpreter();
interpreter.exec("connect('admin','uatwlob1','t3://10.53.253.166:7001')");
interpreter.exec("ls()");
interpreter.exec("createAppRole('obi', 'MYROLE')");
}
catch(Exception e){
System.out.println("Exception:"+e.toString());
}
}
}
-----------------------------------------------
I've connected sussessfully but having a error.
Error:
Exception:Traceback (innermost last):
File "", line 1, in ?
NameError: listAppRoles
Please help me
Thanks.
Post a Comment