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

RSA EJB lookup

Rajani pb
Greenhorn

Joined: May 29, 2009
Posts: 2
I am using RSA for testing the EJB and i am trying to call an EJB from a servlet (part of same EAR) and in the servlet i use the following code.

Context m_initialContext = new javax.naming.InitialContext();
Object objsessionBeanLookup = m_initialContext.lookup("java:comp/env/ejb/UpdateHistory");

The above code is throwing the below exception.
5/30/09 0:52:09:625 CDT] 00000020 SystemErrR javax.naming.NameNotFoundException: Name comp/env/ejb not found in context "java:".
[5/30/09 0:52:09:656 CDT] 00000020 SystemErrR at com.ibm.ws.naming.ipbase.NameSpace.getParentCtxInternal(NameSpace.java:1767)
[5/30/09 0:52:09:656 CDT] 00000020 SystemErrR at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1083)
[5/30/09 0:52:09:656 CDT] 00000020 SystemErrR at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:991)
[5/30/09 0:52:09:656 CDT] 00000020 SystemErrR at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1263)
[5/30/09 0:52:09:656 CDT] 00000020 SystemErrR at com.ibm.ws.naming.java.javaURLContextImpl.lookup(javaURLContextImpl.java:384)
[5/30/09 0:52:09:656 CDT] 00000020 SystemErrR at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:204)
[5/30/09 0:52:09:656 CDT] 00000020 SystemErrR at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:144)
[5/30/09 0:52:09:656 CDT] 00000020 SystemErrR at javax.naming.InitialContext.lookup(InitialContext.java:363)
[5/30/09 0:52:09:656 CDT] 00000020 SystemErrR at EjbClient.doGet(EjbClient.java:38)

How ever the below code works .
Object objsessionBeanLookup = m_initialContext.lookup("ejb/test/UpdateHistoryHome");
UpdateHistoryHome homeInter = (UpdateHistoryHome)PortableRemoteObject.narrow(objsessionBeanLookup, test.UpdateHistoryHome.class);

Can some one explain me what is the difference between the 2 codes ?


Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 443
What is the name and jndi property that you have given in the EJB Reference that you created in RAD/RSA?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61648
    
  67

"Rajani pb", please check your private messages for an important administrative matter.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: RSA EJB lookup