• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

EJB 2.0 local inetrfaces

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many thanks, good answer, it works.
T
 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bras cause cancer. And tiny ads:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic