jQuery in Action, 3rd edition
The moose likes Distributed Java and the fly likes Cannot disconnect client properly from server. RMI. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Cannot disconnect client properly from server. RMI." Watch "Cannot disconnect client properly from server. RMI." New topic

Cannot disconnect client properly from server. RMI.

Sven Sylta

Joined: Aug 09, 2013
Posts: 28
I have a Client-class that connects to my local-server without problem. I'm not sure how to disconnect it properly though. Thanks for your help(Maybe I need to explain more?).

My Server-class
Tony Docherty

Joined: Aug 07, 2007
Posts: 2830
Your client's disconnect method should be calling the server's unregister method (ie it should be basically the same as the client's connect method) rather than trying to unregister the server object from the RMI Registry.
Sven Sylta

Joined: Aug 09, 2013
Posts: 28
Now I need to register every Client in my Server-class in order to be able to broadcast messages to all clients. So I'm trying to pass "this"-client as an argument to my server-registration-method but it is not working. It worked well just passing a "User" as an argument. Why can't I pass "this" ?

This is the new connect-method in the Client-class:

This is the new register-method in the server-class:

The error message:

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: edu.gu.hajo.mbclient.core.Client
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:353)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:556)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)......................

I agree. Here's the link: http://aspose.com/file-tools
subject: Cannot disconnect client properly from server. RMI.
It's not a secret anymore!