• 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 ...
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh


Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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() ???
Author & Gold Digger
Posts: 7617
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
My pie came with a little toothpic holding up this tiny ad:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic