• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with ClassCastException  RSS feed

 
Greg Belyea
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm getting this exception thrown on my Stub file when I run my client side. Anyone got any idea why this would be happening, I was on a roll and this is really holding me up. I've got an interface that extends remote, an implementation that implements the interface. The server bind works no prob with interface = new implementation() blah, blah....
On the client when I run the Naming.lookup and try to cast it as the Interface I get a class cast Exception which doesn't make sense cause it's an interface object that is registered???
Help
Greg
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi....
U can rectify ur problem by casting the object in client side by properly typing the interface name which u have used...
eg: Interface - MyInterface
Server - MyServer
Client - MyClient

MyInterface mi = (MyInterface) Naming.lookup(name);
name = registered name ( ie. Naming.bind()...)
If u r still unable to rectify.. let me know the problem in detail..
use this id for communication scenesen@rediffmail.com
with rgds,
Kumar
 
ramana reddy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

pl check whether interfaces used for server and client are same. It is quite likely that you may be using different class files( having same name ) for these interfaces at serverside and clientside
 
glenn
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you having this Problem with J2EE 1.3? Because I am and I am desparately trying to find the cause/solution.
 
glenn
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just wondering if you had a solution to this and was you problem with a J2EE?
Thanks
Glenn
Originally posted by gbelyea:
I'm getting this exception thrown on my Stub file when I run my client side. Anyone got any idea why this would be happening, I was on a roll and this is really holding me up. I've got an interface that extends remote, an implementation that implements the interface. The server bind works no prob with interface = new implementation() blah, blah....
On the client when I run the Naming.lookup and try to cast it as the Interface I get a class cast Exception which doesn't make sense cause it's an interface object that is registered???
Help
Greg

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!