Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2006-07-01
3
Medium Priority
?
926 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses

618 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