• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ways to get hold of RemoteInterface

 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • 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 Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any suggestion guys?
 
Sergio Tridente
Ranch Hand
Posts: 329
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • 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 Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Resource SessionContext sessionContext
 
Joe Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any ideas on the post above?
 
Sergio Tridente
Ranch Hand
Posts: 329
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • 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 Harry
Ranch Hand
Posts: 10128
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • 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!
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • 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:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic