Originally posted by Will Hunt:
...
But the Spec says only the subclass of RemoteException, NoSuchObjectException can be thrown, Can someone clarify this please.
Thank you.
From
EJB Specs, paragraph 18.2.2:
The container catches a non-application exception; logs it (which can result in alerting the System
Administrator); and, unless the bean is a message-driven bean, throws the java.rmi.RemoteException
(or subclass thereof) to the client if the client is a remote client or web service client, or
throws the javax.ejb.EJBException (or subclass thereof) to the client if the client is a local client.
In the case of a message-driven bean, the container logs the exception and then throws a
javax.ejb.EJBException that wraps the original exception to the resource adapter. (See [12]).
As you can see the container throws a RemoteException (of subclass of it). If you think for a moment, it couldn't be otherwise. Not all the 'unexpected' exceptions from a remote client are received as NoSuchEntityException, on the opposite, this is a very specific exception. On the other end, having a RemoteException thrown by the container to a remote client (I'm insisting on *Remote*, because a *Local* client will get an EJBException, subsclass of RuntimeException, therefore unchecked), is a mean for the Container to say to the client: 'Hey, something went bad on the other side of the wire'.
Marco Tedone<br />SCJP1.4,SCJP5,SCBCD,SCWCD