I have a common problem where I would like to hear your opinion on what's the best way to do it.
Assume you have an application that runs on a distributed server system. Let's say frontend and backend server. Methods on the backend server a called through RMI.
The backend java process usually needs different libraries than the frontend java process. It's possible that a runtime exception occurs in the backend. The thrown exception is not caught by the backend and so it travels to the frontend server. The problem now is that the frontend doesn't know the exception because the package isn't in the classpath (e.g. EJBTransactionRolledBackException). Another exception is thrown - ClassNotFoundException. This makes it impossible to see where the execption occured because the stacktrace doesn't include the stack from the backend server. Another scenario I can think of is where the exception cannot be serialized.
How do you solve this problem? Can I somehow log any runtime exception that is thrown without having to build a try ... catch and rethrow block?