Where is class weblogic.jndi.WLInitialContextFacto

2019-04-05 09:21发布

when trying to execute my jar file I get an exception:

javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory 
[Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]

I guess this is some kind of missing library on the classpath. Can anyone tell me which jar-file is missing? I can't find the class weblogic.jndi.WLInitialContextFactory anywhere...

Thanks!

P.S.: I already have weblogic 10.0 jar included.

8条回答
我命由我不由天
2楼-- · 2019-04-05 09:26

Check your server/lib/ folder to find wliclient.jar.

With Weblogic 12.1.3, you can find it here:
${INSTALL_DIR}/inventory/wlserver/server/lib/wlclient.jar

查看更多
我只想做你的唯一
3楼-- · 2019-04-05 09:27

Check the following tag in your build.xml

property name="WLS_HOME" value="${env.WLS_HOME}"

where WLS_HOME=c:\weblogic\wls\wlserver if running on windows i kept trying to run a simple hello world program and it kept throwing

*run:

 [echo] Executing client class  
 [java] javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]*

once i changed the above mentioned tag it in the build.xml it worked fine

查看更多
趁早两清
4楼-- · 2019-04-05 09:29

it looks you are doing a JNDI lookup outside of WLS.

You need to use wlfulclient.jar or if your machine has a WLS installation then add to your classpath project: WL_HOME/server/lib/weblogic.jar

查看更多
干净又极端
5楼-- · 2019-04-05 09:32

Adding wlserver/server/lib/weblogic.jar is enough. I test it.

查看更多
放我归山
6楼-- · 2019-04-05 09:34

I faced the same issue and it's fixed now :)

The fix is, to go to WebLogic server and navigate to /Oracle/Middleware/wlserver_10.3/server/lib/ and execute the below command.

Command: java -jar wljarbuilder.jar -profile wlfullclient5

The above command creates a jar file with all the jar's inside WebLogic server /lib folder and place it in your client java code build path Eclipse and craetes runnable JAR file and place this wlfullclient5.jar file in server/lib folder as well.

Hope this helps! Kindly let me know if you have any issues.

查看更多
三岁会撩人
7楼-- · 2019-04-05 09:36

It is packaged inside of the weblogic.jar under your server/lib.

查看更多
登录 后发表回答