• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

context.lookup()

 
Giju George
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we are trying to lookup() a bean from another bean, do we need to use PortableRemoteObject.narrow().... assuming both are running on the same JVM ??

And if we don't need, is it an error if we use PRO.narrow() ???
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whether both beans run in the same JVM or not is not the reason why you would not call narrow(). You have to call narrow() whenever you are accessing a bean through its remote interface.

Section 6.6:

The client code must use the javax.rmi.PortableRemoteObject.narrow(...)method to convert the result of the getEJBObject() method invoked on a handle to the remote interface type.


Section 6.10:

A client program that is intended to be interoperable with all compliant EJB Container implementations must use the javax.rmi.PortableRemoteObject.narrow(...) method to perform type-narrowing of the client-side representations of the remote home and remote interfaces.
Note: Programs using the cast operator for narrowing the remote and remote home interfaces are likely to fail if the Container implementation uses RMI-IIOP as the underlying communication transport.

[ August 06, 2004: Message edited by: Valentin Crettaz ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic