Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Shivakanth Thyagarajan
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 528
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Shivakanth Thyagarajan
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic