Client needs a copy of the interface(s)

Lewis Keen <[email protected]> Sat, 21 Jan 2006 06:20:01 -0700
Newsgroups gmane.comp.java.sun.rmi,gmane.spam.detected
Message-ID <LISTSERV%[email protected]>
Hi,

I am currently doing my final year uni project, which is a Texas Hold'em
poker game. I have everything setup and working correctly, the only thing
I'm a little confused about is the GameInterface that I use in order for the
client to connect to the server.

I was under the impression that the client would need a copy of the
interface in order for the code to compile and for the client to connect.
However, I have created a copy of the GameInterface for the client and get
the following error:

java.lang.ClassCastException: $Proxy0
        at dmu.se02lk.poker.client.PokerClient.main(PokerClient.java:20)

where line 20 is:

            GameInterface game= (GameInterface) registry.lookup("Game");

The client has the GameInterface at dmu.se02lk.poker.client.GameInterface
and the server has dmu.se02lk.poker.server.GameInterface, which makes sense.
Previously I had the client setup so that it imports the server
GameInterface, but when this is deployed I'm not sure that it would be the
best idea.

I understand why its throwing the error, since its technically two seperate
GameInterface classes. I'm just not sure how to resolve it. If anyone here
has experience with deploying RMI applications that could shed some light on
this I would be very grateful.

Oh, and I'm using the 1.5 version of RMI.

Thank you for your time,

Lewis Keen

===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html