This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes ClassCastException on client.main Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "ClassCastException on client.main" Watch "ClassCastException on client.main" New topic

ClassCastException on client.main


Joined: Feb 22, 2004
Posts: 1
Hello, I am new to RMI can following's tutorial, I develop
the following program , however I keep getting a ClassCastException
when I try to cast the remote ojbect into it's interface . I've been
stuck 2 days and doesn't have a clue yet!
//a remote interface:
public interface MyInterface extends Remote{
//its implement on server
package server;
public MyImpl extends UnicastRemoteObject implements MyInterface{
ok , now on the client side,NOTE: different package:
//client code
package client
class Client {
String name = "...";
MyInterface remote = (MyInterface)Naming(name); //ClassCastException here
after all codes are done, I have the rmiregistry started ok,
the server started ok
Now when I try to start running my client, it gave me a ClassCastException on main.
when I try println(Naming(name)), it does return the remote object.
I kind of feel that this problem is somehow related to the path setting . I don't know how and why...
please any help would be greatly appreciated!
Thank you
I agree. Here's the link:
subject: ClassCastException on client.main
It's not a secret anymore!