javax.ejb.TransactionRequiredException is a system exception and all system exceptions are reported to client as RemoteException for Remote clients and EJBException for local clients.
However, I agree that javax.ejb.EJBException is also not thrown by the bean since the client seems remote.
Joined: Aug 19, 2005
Originally posted by Ram Prasad: javax.ejb.TransactionRequiredException is a system exception and all system exceptions are reported to client as RemoteException for Remote clients and EJBException for local clients.
Look closely. The question states "javax.transaction.TransactionRequiredException" not "javax.ejb.TransactionRequiredException"
javax.transaction.TransactionRequiredException ISA java.rmi.RemoteException
Joined: Dec 26, 2004
Oops. I meant javax.transaction.TransactionRequiredException.
After some thought (still needs to verify in code), I agree that TransactionRequiredException will be recived by the client.
If interested, this is the reasoning for my earlier post: According to spec 18.1.1 Application exceptions (page 372), "An application exception class must not be defined as a subclass of the java.lang.RuntimeException or of the java.rmi.RemoteException." Taking this into consideration, TransactionRequiredException is a system exception (also mentioned in SCBCD Study kit). And my understanding was that remote clients will recieve RemoteException for any generated System exception. This led me into believing that TransactionRequiredException might be wrapped into a RemoteException before passing it to client.
But since TransactionRequiredException ISA RemoteException, the container simply throws it with out any wrapping.
Joined: Aug 19, 2005
In this case the relevant section in the spec was under "126.96.36.199 Mandatory":
If the client calls without a transaction context, the Container throws the javax.transaction. TransactionRequiredException exception if the client is a remote client, or the javax.ejb.TransactionRequiredLocalException if the client is a local client.
Also note it's "javax.ejb.TransactionRequiredLocalException", not "javax.ejb.TransactionRequiredException" (missed the "Local")