File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot disconnect client properly from server. RMI.

 
Sven Sylta
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Pie
Posts: 2878
59
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic