aspose file tools*
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


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Need more detail of PortableRemoteObject.narrow" Watch "Need more detail of PortableRemoteObject.narrow" New topic
Author

Need more detail of PortableRemoteObject.narrow

Junglee Hippie
Greenhorn

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
Greenhorn

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.

Thanks
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

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 :
http://java.sun.com/products/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="http://groups.yahoo.com/group/scjp_share" target="_blank" rel="nofollow">SCJP Group</a><br /><a href="http://groups.yahoo.com/group/JavaBeat_SCWCD" target="_blank" rel="nofollow">SCWCD Group</a>
 
jQuery in Action, 2nd edition
 
subject: Need more detail of PortableRemoteObject.narrow
 
Similar Threads
Narrowing
Studying for 484
PortableRemoteObject.narrow Explain
PortableRemoteObject.narrow()
Got ClassCastException with EJB3, please help!