Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB 2.0 local inetrfaces  RSS feed

 
le taylom
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to write a session ejb that talks to another sesion ejb using LOCAL interfaces, as per the ejb 2.0 spec.
However I am falling at the first hurdle as to how to do the lookup for the LocalHome interface object.
The way it would be done using REMOTE interfaces would be to do the javax.rmi.PortableRemoteObject.narrow on the remote home inetrface class.
But I cannot work out, and canot find an example, as the steps required to do this fgor local interfaces.
If someone can provide me with an example for this step i would be grateful.
Cheers
T
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to do a narrow. You can simply cast the object to your home local object. Here is an example from "Enterprise Java Beans - 3rd Edition".
This is the code of a local client trying to get a reference to a local home object called CabinHomeLocal:
javax.naming.Context jndiContext = new InitialContext();
CabibHomeLocal home = (CabinHomeLocal) jndiContext.lookup("java:comp/env/ejb/CabinHomeLocal");
Hope this helps.
 
le taylom
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many thanks, good answer, it works.
T
 
Francisco A Guimaraes
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, just a doubt: do you have to manually define that reference "comp/env/ejb/CabinHomeLocal"? I�m using Websphere Studio 5 from IBM, can you help me?
Francisco
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Francisco A Guimaraes:
Hi, just a doubt: do you have to manually define that reference "comp/env/ejb/CabinHomeLocal"? I�m using Websphere Studio 5 from IBM, can you help me?
Francisco

Yes, you need to define a local reference in your deployment descriptor to use local EJBs in WAS. If you want more details on this then I suggest you mosey on over to the IBM/Websphere Forum.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!