File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Local versus remote interfaces

 
Stefan Guilhen
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Keerthi P
Ranch Hand
Posts: 203
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stefan Guilhen
Ranch Hand
Posts: 61
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 203
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic