Win a copy of Secure Financial Transactions with Ansible, Terraform, and OpenSCAP this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

RemoteException in B&S

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 697
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic