File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RSA EJB lookup

 
Rajani pb
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 446
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64171
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Rajani pb", please check your private messages for an important administrative matter.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic