Originally posted by Will Hunt:
Which is true when an entity bean's client receives a java.rmi.RemoteException?
A The client must be local.
B A checked exception was propagated from the bean.
C The client is not required to handle or declare the exception.
D This exception can never occur if the client is in a transaction.
What would be the answer and why ?
I think is D (also because there is no other possibility) and here follows my reason:
1) It cannot be A, because RemoteException is a way for the container to inform a remote client that 'something went wrong' on the server;
2) It cannot be B, because in case of checked exceptions, the container propagates the checked exception to the client as it is, not re-wrapping it in a RemoteException;
3) Remote clients needs to handle or declare the RemoteException on a remote method invocation. Is the way Remote Objects have to inform the client that it's dealing with a remote object. Remember that with RMI, the client point of view is that it is performing a normal method invocation, because RMI goal is to realize network transparency for the client when it comes at invoking remote methods;
4) So, it must be D. The reason is that a RemoteException, although is a checked exception, is thrown by the container when a system exception (read: something that the client didn't expect) happened on the server. This means that on the server a runtime exception must have occurred. When a runtime exception occurs, the server rolls-back the transaction (therefore the client is not in a transaction any more), kills the bean instance (not the underlying entity), logs the error, and throws a RemoteException to the client.
If it's not D...Well, I'm in trouble
:roll: