Solved

Already set weblogic.jar in the classpath, but "cannot instantiate class: weblogic.jndi.WLInitialContextFactory" error.

Posted on 2006-07-01
3
594 Views
Last Modified: 2013-11-24
Hi,

I have set weblogic.jar in classpath, but still having this error.

Error  NamingException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory

This is part of code:
+++++++++++++++++++++++++
public void PrintStudentInfo(){
             Context initcntx = null;
               Hashtable ht = new Hashtable();  
               ht.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
               ht.put(Context.PROVIDER_URL, "t3://localhost:7001");
               ht.put(Context.SECURITY_PRINCIPAL, "userId");  
               ht.put(Context.SECURITY_CREDENTIALS, "password");  

BTW, this is just java program.

thanks,
0
Comment
Question by:dkim18
  • 2
3 Comments
 
LVL 92

Expert Comment

by:objects
ID: 17026282
it may not be that it can't find the class, instead that for some reasone it is failing to create it.
try displaying the full stack trace
0
 

Author Comment

by:dkim18
ID: 17026354
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:652)
      at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
      at javax.naming.InitialContext.init(InitialContext.java:219)
      at javax.naming.InitialContext.<init>(InitialContext.java:195)
      at PrintStudentInfoFromPool.PrintStudentInfo(PrintStudentInfoFromPool.java:30)
      at PrintStudentInfoFromPool.main(PrintStudentInfoFromPool.java:66)
Caused by: java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory
      at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:219)
      at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
      at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)
      ... 5 more
java.lang.NullPointerException
      at PrintStudentInfoFromPool.PrintStudentInfo(PrintStudentInfoFromPool.java:58)
      at PrintStudentInfoFromPool.main(PrintStudentInfoFromPool.java:66)
0
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 17026363
how r u running your app? appears to not be reading your classpath
have u tried copying the jar to the ext directory of the jre you are running
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
split53 challenge 7 99
micro services spring boot application error 3 199
Should localization be done inside spring controller 5 27
couple of eclipse 5 38
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question