Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sending objects via RMI...

0 views
Skip to first unread message

Mick Jagger

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to

Hi all,

I've gotten 99% of RMI to work like a charm, but one niggling problem Ive
encountered, and I cant fix...

I'm trying to send a Message object to the server from a client. Class
Message looks a little like this:

public class Message implements Serializable
{

private int MessageType;
private int UserFrom;
private int UserTo;
private Client ClientRef;
private String Message;

public Message(int type, int from, int to, Client cli, String str) throws
Exception {

MessageType = type;
UserFrom = from;
UserTo = to;
ClientRef = cli;
Message = str;
// etc etc etc....


} // end default constructor


Thats all thats important for here I guess... When I try sending an instance
of it to the server, I get this error message:

D:\cs280\PREVIEW\code\tmp>java samplegui
class Client attempting to find server...

Client reports Server lookup is ok...

java.lang.ClassCastException: Assigning instance of class Client_Stub to
field M
essage#ClientRef
at
sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
RemoteCall.java:249)
at
sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
224)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
at Server_Stub.login(Unknown Source)
at Client.userLogin(Client.java:50)
at samplegui.main(samplegui.java:47)
Client reported a bad login :(


So from this the client connects to the server ok, and finds the login()
method... as soon as it tries to send a Message object, whammo, it dies..
This error message I simply cannot work out... Anyone have any ideas ?


Hope someone can help!

Best regards,

Shane Lilley


0 new messages