This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi Guys, I did a summary after reading exception of HFEJB --- all the RuntimeException (such as nullpointerexception, indexoutofarrayexception...) plus RemoteException thrown by bean, the remote client will only get RemoteException while the local client will only get EJBException. As for those exceptions thrown by container or stub, need do more detail analysis.
Is my summary right? It it is, then it will help us to remember those various exceptions Any suggestion is welcomed.
Originally posted by Roger Chung-Wee: RemoteException must never be thrown by a bean.
Thanks Roger, that's correct, I have overlooked that one in Hai's post.
A RemoteException can only be thrown by the container when: 1. the bean throws a system exception (a RuntimeException or a checked exception wrapped in an EJBException) AND 2. there is no caller transaction available
For session and entity beans, RemoteException is thrown regardless of the caller transaction.
If a business method of a CMT session bean or a CMT entity bean throws a non-application exception, the container will then always throw RemoteException to a remote client.
If the method was running with an unspecified transaction context or in the context of a transaction which the container had started immediately prior to running the method, RemoteException will be thrown.