File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Need more detail of PortableRemoteObject.narrow Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Need more detail of PortableRemoteObject.narrow" Watch "Need more detail of PortableRemoteObject.narrow" New topic

Need more detail of PortableRemoteObject.narrow

Junglee Hippie

Joined: Apr 09, 2007
Posts: 3
Hello Frndz,
I am new to EJB and just started preparing for BCD. I am unable to understand why do we use PortableRemoteObject.narrow.

Why is the need of narrowing,as I have gone through HFEJB also but could not make somethin solid out of that.

Please help... and explain.

Thanks in Advance

Junglee Hippie<br />Jaipur
Gaurav Chugh
Ranch Hand

Joined: Aug 28, 2001
Posts: 50
Even though i dont the reason for it, but i do know that it is something to do with narrowing like type casting and this is only done for the remote home object , if you see some other example for local client view , there narrowing is not required as it is already in same form for local home interface type. We will see somebody post reply on it.

Regards<br />gaurav..
bala nannaka
Ranch Hand

Joined: Apr 02, 2007
Posts: 49
EJB uses rmi-iiop .that means every call is transferred into iiop format.
so you need to type cast the call into your own formatt.narrow method is used to type cast the object type into your required type.
Junglee Hippie

Joined: Apr 09, 2007
Posts: 3
Thanks for the reply but this is all that is already there in the HFEJB, ne ways thanks a lot for the replies I would like to know the internal working of RMI-IIOP.
If anybody could help.

Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

If you're going for the exam, I think you should focus on what is in your book first, and dig deeper into the details afterwards.
You can still refer to the following site for documentation on RMI-IIOP :

[My Blog]
All roads lead to JavaRanch
Raghu Shree
Ranch Hand

Joined: Mar 18, 2005
Posts: 143
Using lookup method we can get the remote home object, we need to cast the return object to our desired remote home object. But we can�t explicity casting thsese object because of CORBA standards. (casting is not native). Java RMI-IIOP standards provides the PortbaleRemoteObject.narrow() method to casting the object to appropriate type.

Note: If we using Local interface we can do explicit casting as normal java way.

Raghu J<br />SCJP 1.4<br /> <br />The Wind and waters are always<br />on the side of the ablest navigators.<br /><a href="" target="_blank" rel="nofollow">SCJP Group</a><br /><a href="" target="_blank" rel="nofollow">SCWCD Group</a>
I agree. Here's the link:
subject: Need more detail of PortableRemoteObject.narrow
It's not a secret anymore!