I have an RMI server and a desktop RMI client. When I restart the server, I get errors in the client. Is it possible to restart the RMI connection without restarting the cli
When the server is terminated, you will receive a ConnectException. After that you can just use Naming.lookup to get a new server object.
If you're using Spring (namely RmiProxyFactoryBean), you can simply set the property refreshStubOnConnectFailure
to true
and the bean will survive a restart of the server.
<property name="refreshStubOnConnectFailure" value="true" />