Name

EJBException

Synopsis

The EJBException is thrown by an enterprise JavaBean implementation when it encounters an error during the execution of a client-invoked business method, or a container-invoked notification method. The container receives the exception (since it serves as a proxy for all client interactions with the bean), and is responsible for converting the EJBException to an appropriate subclass of java.rmi.RemoteException to be returned to the client.

If the EJB object was operating within a container-defined transaction context when the exception was thrown, then the container does a rollback on the transaction before throwing the RemoteException to the client. If the bean was operating within a client-defined transaction context, then the container marks the transaction for rollback, and throws a javax.transaction.TransactionRolledbackException (a subclass of RemoteException) to the client, to indicate that it should give up on its transaction.

                  Implementations
public class EJBException extends RuntimeException {
// Public Constructors
   public EJBException();  
   public EJBException( Exception ex);  
   public EJBException( String message);  
   public EJBException( String message, Exception ex);           // 2.0
                  // Public Instance Methods
   public Exception getCausedByException();                      // default:null
                  // Public Methods Overriding Throwable
   public String getMessage();                                   // default:null, 2.0
   public void printStackTrace ...

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.