aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Access JNDI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Access JNDI" Watch "Access JNDI" New topic
Author

Access JNDI

prasad kulkarni
Ranch Hand

Joined: Mar 19, 2006
Posts: 66
How could I make a lookup to an JNDI located on remote machine. My ejb is deployed on a different maachine & web module is on another machine I want to make a looup for that EJB but not able to locate EJB. Is any sol^n?


scjp, scwcd
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by prasad kulkarni:
How could I make a lookup to an JNDI located on remote machine. My ejb is deployed on a different maachine & web module is on another machine I want to make a looup for that EJB but not able to locate EJB. Is any sol^n?


What do you mean by could not locate EJB ? Are you getting exceptions ?


Groovy
prasad kulkarni
Ranch Hand

Joined: Mar 19, 2006
Posts: 66
I am using webSphere & this is the code that I am trying :

Hashtable env = new Hashtable();
env.put(Context.PROVIDER_URL,"iiop://localhost:2809");
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");

But it is giving me exception of ClassNotFound : com.ibm.websphere.naming.WsnInitialContextFactory,

though I have included ns.jar in class path
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Do a javap com.ibm.websphere.naming.WsnInitialContextFactory and make sure that the class is found.
Elid OR
Greenhorn

Joined: Jun 14, 2006
Posts: 6
Your war is deployed on webshere too ?
You said that ejb are deployed on a remote machine why do you use localhost in the urlprovider ?


SCJP 5
prasad kulkarni
Ranch Hand

Joined: Mar 19, 2006
Posts: 66
Remote machine means same machine with different JVM. The war is deployed in the websphere in same machine-different JVM.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
classpath is not typically used by application servers.

Have you tried including the ns.jar in your application's lib directory?


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Access JNDI