• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ways to get hold of RemoteInterface

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

Please correct me if I'm wrong. I suppose that there are three ways to get hold of the RemoteInterface reference as below,

(1) Through @EJB annotation
(2) Through @Resource annotation
(3) Through JNDI lookup (If the client is remotely deployed)

Any suggestions?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any suggestion guys?
 
Ranch Hand
Posts: 329
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jothi Shankar Kumar Sankararaj:

(1) Through @EJB annotation
(2) Through @Resource annotation
(3) Through JNDI lookup (If the client is remotely deployed)



How would you get a reference through the @Resource annotation?

I can only think of these 3 ways:

1) Dependency injection using the @EJB annotation
2) Dependency injection using the ejb-ref ejb-local-ref elements of the deployment descriptor.
3) By doing a JNDI lookup using the javax.naming.Context interface or the EJBContext.lookup() method.
[ September 05, 2008: Message edited by: Sergio Tridente ]
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Resource SessionContext sessionContext
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any ideas on the post above?
 
Sergio Tridente
Ranch Hand
Posts: 329
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jothi Shankar Kumar Sankararaj:
@Resource SessionContext sessionContext



I would't call it a way for obtaining a RemoteInterface. It is a way for obtaining the SessionContext object. You can then, of course, use the lookup() method on that object to get the RemoteInterface reference, but it is still a JNDI lookup.
[ September 08, 2008: Message edited by: Sergio Tridente ]
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sergio Tridente:


I would't call it a way for obtaining a RemoteInterface. It is a way for obtaining the SessionContext object. You can then, of course, use the lookup() method on that object to get the RemoteInterface reference, but it is still a JNDI lookup.

[ September 08, 2008: Message edited by: Sergio Tridente ]



Thanks Sergio, you have been helpful!
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As far as i know, the @Resource can be used to inject any resource from the JNDI. So injecting a remote bean should also be possible. I was thinking of doing this as follows:

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic