• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

new to EJB

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to do a JNDI lookup to get a handle on an EJB (TrackHome). I am using WebSphere 6.0. My code is as follows:

Properties prop = new Properties();
prop.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
prop.setProperty(Context.PROVIDER_URL, "iiop://localhost:2809/");
javax.naming.InitialContext ctx = new InitialContext(prop);
Object obj = ctx.lookup("ejb/album/AlbumHome");
TrackHome ejbHome = (TrackHome)
PortableRemoteObject.narrow(obj,TrackHome.class);


But when I run it I get the following error:

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:375)
at java.lang.ClassLoader.loadClass(ClassLoader.java:562)
...

If I should not use "WsnInitialContextFactory", what should I use?

I am new to EJB, so please excuse me if this seems daft. Has anyone got any links to working with EJBs in WebSphere 6?


PS> I have tried "com.sun.jndi.fscontext.RefFSContextFactory", but get the following error:

javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.jndi.fscontext.RefFSContextFactory. Root exception is java.lang.ClassNotFoundException: com.sun.jndi.fscontext.RefFSContextFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:375)
at java.lang.ClassLoader.loadClass(ClassLoader.java:562)


and "com.ibm.ejs.ns.jndi.CNInitialContextFactory" but get:

javax.naming.NoInitialContextException: Cannot instantiate class: com.ibm.ejs.ns.jndi.CNInitialContextFactory. Root exception is java.lang.ClassNotFoundException: com.ibm.ejs.ns.jndi.CNInitialContextFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:375)
at java.lang.ClassLoader.loadClass(ClassLoader.java:562)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:442)
 
Blikkies Marais
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a new class in WAS6.0 that has taken the place of "com.ibm.websphere.naming.WsnInitialContextFactory"?

If so, what is it.

Thanks
 
It's a pleasure to see superheros taking such an interest in science. And this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic