aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes ClassCastException ;  javax.rmi. Portable Remote Object. narrow(Unknown Source) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "ClassCastException ;  javax.rmi. Portable Remote Object. narrow(Unknown Source)" Watch "ClassCastException ;  javax.rmi. Portable Remote Object. narrow(Unknown Source)" New topic
Author

ClassCastException ; javax.rmi. Portable Remote Object. narrow(Unknown Source)

Shivakanth Thyagarajan
Ranch Hand

Joined: Mar 28, 2005
Posts: 41
Dear Ranchers,
I am trying to run AdviceClient and i am getting the below exception.

java.lang.ClassCastException
at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(Unknown Source)
at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
at AdviceClient.go(AdviceClient.java:24)
at AdviceClient.main(AdviceClient.java:11)

I have done all possible things. I have j2ee.jar in the classpath and the client jar also in the classpath. I tried to find it in the google but with little vain. I am using j2ee 1.4 server and Operating system is Windows XP.

Please help me out. I have lost my patience.

Thanks
Shivakanth.T
Marcelo Ortega
Ranch Hand

Joined: May 31, 2005
Posts: 519

Hi Shivakanth
Make sure that the class type which you pass as an argument to the narrow method is of the same type as the home interface and that the cast is being made to that same home type. Also, make sure that the
home is not local.

Regards,
Mars.


SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJD, SCEA/OCMJEA

Live life to an interface, not an implementation!
Shivakanth Thyagarajan
Ranch Hand

Joined: Mar 28, 2005
Posts: 41
I could solve this we need to add one more jar file in the CLASSPATH and it works.

<install-dir>\lib\appserv-rt.jar

Hope this would be helpful for someone in future.

Thanks
Shivakanth.T
Conor Williams
Greenhorn

Joined: Oct 31, 2012
Posts: 4
probably a bit late but,
i got it by running it like this: (pointing to the jar created by RI)
C:\ejb\headfirst>c:\j2sdk1.4.2_15\bin\java -classpath adviceappClient.jar;%CLASS
PATH% AdviceClient

happy Christmas!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ClassCastException ; javax.rmi. Portable Remote Object. narrow(Unknown Source)