RemoteException in EJB

Giju George

Ranch Hand

Posts: 333

posted 12 years ago

Can the bean itself throw a RemoteException?. According to HFE, if the bean throws a system Exception(unchecked/runtime), then the container gets the exception and throws to the client as a "RemoteException". So , here the container is throwing the RemoteException.

SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCEA

Nicholas Cheung

Ranch Hand

Posts: 4982

posted 12 years ago

Can the bean itself throw a RemoteException?

NO. According to the specification, the bean itself cannot throw RemoteException.

If the bean is serving a local client and throws a system exception, the container will wrap it into EJBException, and rethrows this to the client. If the bean is serving a remote client and throws a system exception, the container will wrap it into RemoteException, and rethrows this to the client.

According to HFE, if the bean throws a system Exception(unchecked/runtime), then the container gets the exception and throws to the client as a "RemoteException". So , here the container is throwing the RemoteException.