Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Why can't I get an initial context in websphere!?!

843829Jan 8 2003 — edited Jan 13 2003
I am using WebSphere App Dev v.4.0, and I have written a client application which should call methods from an EJB. But I don't seem to be able to get an initial context no matter what I do. Here is a snippet of the app code and the exception it throws: I will be most grateful if someone could help me out. Thanks Ben.

THE CODE...
try {  	    
    System.out.println("about to retrieve initial context.");    
    java.util.Properties p = new java.util.Properties();    
    p.put(Context.PROVIDER_URL, "iiop://localhost:901");    
    p.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");    
    InitialContext initContext = new InitialContext(p);
    System.out.println("initial context has been created.");	
}catch (Exception e) {         
    e.printStackTrace();
}
THE EXCEPTION...

about to retrieve initial context.
javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.websphere.naming.WsnInitialContextFactory. Root exception is java.lang.ClassNotFoundException: com.ibm.websphere.naming.WsnInitialContextFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:325)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:257)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:212)
at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:656)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:199)
at BeanClient.main(BeanClient.java:18)
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 10 2003
Added on Jan 8 2003
5 comments
1,338 views