I don't know if this will help.
I was having a problem that was the same or similar. I love RmiProxyFactoryBean, but it annoyed me that it would throw RemoteAccessExceptions on connection problems, which would bypass my catch RemoteException blocks and screw up the works. I know the Spring guys think that most exceptions are unrecoverable; perhaps they’ve been working the in presentation layer too much.
In my case, I actually could recover from a remoting exception. I didn’t want to add catch RemoteAccessException blocks everywhere my remote methods were called. Indeed, why should I; RemoteAccessException isn’t in the throws clauses or javadocs of my remote methods. This whole unchecked exceptions thing is silly. Why is Spring going against the longstanding best practices for Java exceptions anyway?
I get it that, in this particular case, RmiProxyFactoryBean can hide the fact that an object is remote (which, BTW, goes against distributed computing best practices: http://research.sun.com/techrep/1994/abstract-29.html). But when the proxied interface extends java.rmi.Remote, it should just throw RemoteException on connection problems. Or at least make it configurable.
Long story short (too late), I subclassed RmiProxyFactoryBean to get the desired behaviour:
Code:
/**
* Throws {@link RemoteException} instead of the silly {@link RemoteAccessException}s
*
*/
public class MyRmiProxyFactoryBean extends RmiProxyFactoryBean {
@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
try {
return super.invoke(invocation);
} catch (RemoteAccessException e) {
throw new RemoteException("", e);
}
}
}