this is my first post. I`m trying to execute a simple java program from Netbeans that connect with Weblogic 12c in Windows 10, with no success.I checked starckoverflow with no luck. Is for a college work.
1)I installed Netbeans 8.2 with java jdk1.8.0_161 and jre.8.0_161 2)I installed Weblogic 12.c 3) Weblogic start and stop works fine. wlst.cmd works fine to. I can connect manually and execute scripts (connect('weblogic', 'weblogic', 'localhost:7001'))
4) Enviroment is configured, Ive checked manually all the scripts below
C:\Oracle\Middleware\Oracle_Home\oracle_common\common\bin>setWlstEnv
Execute... setWlstEnv.cmd
Execute... setWlstEnv_internal.cmd
Execute... setHomeDirs.cmd
Execute... commBaseEnv.cmd
5) C:\Oracle\Middleware\Oracle_Home\wlserver\server\lib is in the classpath, the weblogic.jar is in the classpath. I added all the jars too to the project: C:\Oracle\Middleware\Oracle_Home\wlserver\server\lib
6) JAVA PROGRAM:
package weblogic;
import weblogic.management.scripting.WLST; import weblogic.management.scripting.utils.WLSTInterpreter;
public class WEBLOGIC {
public static void main(String[] args) {
WEBLOGIC wrapper = new WEBLOGIC();
wrapper.doSomething();
}
public void doSomething() {
WLST.ensureInterpreter();
WLSTInterpreter interpreter = WLST.getWLSTInterpreter();
interpreter.exec("connect('weblogic', 'weblogic', 'localhost:7001')");
interpreter.exec("ls()");
}
}
I can't find info related even in google or stackoverflow. Thanks for the help.
Solution:
Several different versions of weblogic.jar in the classpath, produced the runtime error: No such Field Error. With only one (the right one) works fine.
Establish the connection : Connection URL : connect('weblogic','weblogic','t3://localhost:7001') Connecting to t3://localhost:7001 with userid weblogic ... Successfully connected to Admin Server 'AdminServer' that belongs to domain 'ClassicDomain'.
Warning: An insecure protocol was used to connect to the server. To ensure on-the-wire security, the SSL port or Admin port should be used instead.
BUILD SUCCESSFUL (total time: 2 seconds)