Mar 12th, 2007, 10:21 AM
How to handle exception during bean creation
I'm attempting to connect to an exported RMI object on another server from within an application context. If that RMI object is not available I get an RMI exception which causes issues during application startup.
How are these exceptions supposed to be handled within Spring?
Mar 12th, 2007, 01:28 PM
I'll answer my own question:
For the RMI object being obtained through the RmiProxyFactoryBean turn off "lookupStubOnStartup" and turn on "refreshStubOnConnectFailure".
The resulting behavior will allow the RemoteAccessException to be caught in your POJO and dealt with appropriately at that level. In my case I simply caught the exception and start a timer that attempted to reconnect.