Solved

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

Posted on 2006-07-01
3
591 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
splitOdd10 challenge 5 81
create a gui in perl 3 72
what is the difference between "sudo su" and "su - root" 6 106
jar file executable 12 43
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This video teaches viewers about errors in exception handling.

862 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now