javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory

4.2k views Asked by At

In eclipse same code is working fine when executed as simple java program. But when same is called through Dynamic Web project it is throwing exception "javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]"

wlfullclient.jar is also attached to dynamic web project kept in WebContent\WEB-INF\lib folder.

Code is as follows. Thanks in advance

Hashtable env = new Hashtable();
     env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
     env.put(Context.PROVIDER_URL, url);
     return new InitialContext(env);
1

There are 1 answers

0
Baljinder Singh On

It seems Tomcat dynamic Web project one should use 'wlthint3client.jar' instead of 'wlfullclient.jar'. I copied the 'wlthint3client.jar' in lib folder and project was working fine after that.