This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Local versus remote interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Local versus remote interfaces" Watch "Local versus remote interfaces" New topic
Author

Local versus remote interfaces

Stefan Guilhen
Ranch Hand

Joined: Jul 31, 2004
Posts: 61
Hi all,

The EJB2.0 specification says (pages 63-64) that local interfaces must not be passed as an argument or result of a method on a bean's remote home or component interfaces. This makes sense since a plain old Java reference has no meaning outside the JVM it was created and you need a stub in this case. So I understand that remote interface methods can only deal with remote bean's references.

But notice that the specification doesn't say anything about passing or returning remote interface references from a method on a bean's local home or component interfaces. On the other hand, HF-EJB on page 161 says: "Ok, there is one exception - remember, according to Bean law you must not return a bean's Remote interface from a local interface method". Why not? Why doesn't the spec mention this? It seems to me that a local client using a remote reference should work.

Thanks in advance,
Stefan


SCJP 1.4, SCBCD 1.3<br />IBM 141, 484, 486
Keerthi P
Ranch Hand

Joined: Aug 19, 2003
Posts: 203
HF-EJB on page 161 says: "Ok, there is one exception - remember, according to Bean law you must not return a bean's Remote interface from a local interface method". Why not? Why doesn't the spec mention this? It seems to me that a local client using a remote reference should work


Good catch. It does sound right to me too! Why can't a bean, local to the container, lookup a remote bean and return its remote component interface to its clients?

Can someone pls help us map this 'Bean law' to the spec.


Cheers.<br />Keerthi<br />(SCJP, SCWCD, SCBCD)
Stefan Guilhen
Ranch Hand

Joined: Jul 31, 2004
Posts: 61
Hi Keerthi, thanks for your reply.

I re-read the specification and I still didnt find a law saying that "you can NEVER mix interfaces". The specification only cares about the fact that you cannot pass local references to methods on remote interfaces, but it doesn't mention the case we found in HF-EJB (passing remote references to methods on local interfaces).

Thanks again,
Stefan (still stuck trying to figure this out)
Keerthi P
Ranch Hand

Joined: Aug 19, 2003
Posts: 203
I didn't really get a chance to validate this by writing a sample code (Will try to do it over this week-end). But it surely should work. Still wondering why Kathy/Bert does not prefer to 'return a bean's Remote interface from a local interface method'.

Lets wait for their response
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Local versus remote interfaces