• Post Reply Bookmark Topic Watch Topic
  • New Topic

access ejb from weblogic; ejb is deployed in websphere

 
mohan infy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I deployed ejb in websphere 5.1. I could able to access this from Servlets which are also running in same websphere environment.
When I tried to access same EJB (deployed in websphere) from Weblogic environment, it is giving following error.

javax.naming.NameNotFoundException: Exception in lookup.: `ejb/com/ejb/session/sample/SampleSessionHome' could not be found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL mg.org/CosNaming/NamingContext/NotFound:1.0

Thanks in advance.
Mohan
 
Alex Sharkoff
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mohan,

You need to create a different javax.naming.InitialContext that knows how to connect to your app server (in your case it will be websphere).



 
mohan infy
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Alex,

Yes. In same way I am doing as you said.
java.util.Hashtable properties = new java.util.Hashtable(2);
properties.put(javax.naming.Context.PROVIDER_URL, "iiop://localhost:2809");
//properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory");
properties.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
initContext = new javax.naming.InitialContext(properties);

Object obj = initContext.lookup("ejb/com/ejb/session/sample/SampleSessionHome");

-Mohan
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!