java.lang.ClassCastException

Hello,

I want to pass an object called UserNodeData through RMI from the server to the client.

In the client side i create an object with the type of the interface of UserNodeData (the interface is called RemoteLinkman) . Here is the piece of code that make the error (client side) :

RemoteLinkman server;

public void afficher(Graph g) throws RemoteException {

UserNodeData d = (UserNodeData)server.getRootNode();

UserNode node = new UserNode(d,g,this);

node.afficherLesVoisins(5);

}

I launch the server side first and then i want to launch the client. After that the connection is established is the following error (on the piece of code behind) :

Exception in thread "main" java.lang.ClassCastException: $Proxy2 cannot be cast to ch.globalcard.linkman.server.UserNodeData

at $Proxy1.getRootNode(Unknown Source)

at linkman.NodeManagerClient.afficher(NodeManagerClient.java:36)

What can be the origin of this error ?

Best regards

[1021 byte] By [manchzeka] at [2007-11-27 9:31:51]
# 1
The client doesn't have a UserNodeData, it has an instance of RemoteLinkMan.Change 'UserNodeData' to 'RemoteLinkMan' in the client code.
ejpa at 2007-7-12 22:47:50 > top of Java-index,Core,Core APIs...