• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.rmi.ConnectException

 
K. Tsang
Bartender
Posts: 3404
13
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, java.rmi.ConnectException is subclass of java.rmi.RemoteException. I encounter this situation:

1. start RMI server
2. run network client
3. do something eg search/book etc
4. stop server
5. do something -> got ConnectException and NOT EXIT APP
6. start server again
7. do something -> still get ConnectException

Why is this? I use a service layer in between client and server. When I start my client, I have a getService method to get the server/database instance. Then I pass this parm to my other objects.
 
Kevin Florish
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I am aware this is correct behaviour.

Stopping the server severs the link you had when you started your client (proxy/stub relationship). So restarting the server won't reconnect this
link and so after stopping and restarting the server you still need to restart the client to reconnect the link. At least this is my understanding and
is also the way my code works.
 
K. Tsang
Bartender
Posts: 3404
13
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kevin, then my app is behaving correctly.
 
Alain Dickson
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My RMI connection behaves like this: have a look at the link

http://www.coderanch.com/t/189222/Developer-Certification-SCJD/certification/RMI-it-s-unknown-ways
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic