File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes RemoteException in B&S Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "RemoteException in B&S" Watch "RemoteException in B&S" New topic
Author

RemoteException in B&S

David Ding
Greenhorn

Joined: Mar 19, 2004
Posts: 9
I've finished both the standalone and the rmi parts, but I met a strange problem while testing with two clients.
Step 1: java -jar runme.jar server
Start the server, everything is ok.
Step 2: java -jar runme.jar
Start the client 1, all the operations are ok, they work well.
Step 3: java -jar runme.jar
Start the client 2, no exception occured while operating both the two clients.
Step 4: close one client
While I want to do any operations on the remaining client, it fails, in the message box:
RemoteException occurred in server thread; nested exception is:
java.rmi.ConnectException: Connection refused to host: 192.168.1.63; nested exception is:
java.net.ConnectException: Connection refused: connect
If I use only one server and one client, I first close the client, and then start a new one, the same problem happened again.
I am confused now, what's wrong with my rmi?


SCJP 1.4
Satish Avadhanam
Ranch Hand

Joined: Aug 12, 2003
Posts: 697
Hi David
Originally posted by David Ding:
I've finished both the standalone and the rmi parts, but I met a strange problem while testing with two clients.
Step 1: java -jar runme.jar server
Start the server, everything is ok.
Step 2: java -jar runme.jar
Start the client 1, all the operations are ok, they work well.
Step 3: java -jar runme.jar
Start the client 2, no exception occured while operating both the two clients.
Step 4: close one client
While I want to do any operations on the remaining client, it fails, in the message box:
RemoteException occurred in server thread; nested exception is:
java.rmi.ConnectException: Connection refused to host: 192.168.1.63; nested exception is:
java.net.ConnectException: Connection refused: connect

My understanding is that when you close one client, you are making some static variable on the server side null maybe or something like that. The reason why am thinking like that when one client exits the application, another client should work without any problem. So I think you are using some static variable on server side which identifies any client.
Another reason might be, you might have been using same reference for all clients and store the reference on server side. So when a client exits, you might be making it null and so the next operation on the server might be resulting this exception. To say, server is holding a reference to client(and I think the same reference is identifying all clients) remote client and so the exception might be occuring.
I am not sure if I'm correct about my explanation. If you find out any other reason please let me know. Thanks.
GoodLuck.

If I use only one server and one client, I first close the client, and then start a new one, the same problem happened again.
I am confused now, what's wrong with my rmi?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RemoteException in B&S