3 Replies Latest reply on Jan 8, 2006 7:17 PM by Thomas Orr

    EJBException vs. RemoteException

    Thomas Orr Newbie

      It seems as though EJB3 has gotten rid of RemoteExceptions and simply replaced them with EJBExceptions. I do not see how this is an improvement. Other than the fact that the EJBExceptions are RuntimeExceptions, there is no improvement as I see it. Every single Exception I throw from my EJB is wrapped in an EJBException. Therefore, in my client code I still have to be aware of the underlying implementation just as I did with RemoteExceptions. Then I have to use the getCausedByException and do instanceof until my code is a mess of if statements.

      As an interim solution I've got Spring AOP intercepting thrown Exceptions, and turning them back into the original Exception. This works, but it's a hack I've been forced into.

      Has anyone else run into this annoyance, or am I doing something wrong?