Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RemoteException in B&S

 
David Ding
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Satish Avadhanam
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic