Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Enterprise JavaBeans™ Specification, v1.1 - Sun Microsystems.pdf
Скачиваний:
11
Добавлен:
24.05.2014
Размер:
1.62 Mб
Скачать

Sun Microsystem Inc

System Administrator’s responsibilities

Enterprise JavaBeans v1.1, Final Release

Exception handling

12.4.2.1 javax.transaction.TransactionRolledbackException

The javax.transaction.TransactionRolledbackException is a subclass of the java.rmi.RemoteException. It is defined in the JTA standard extension.

If a client receives the javax.transaction.TransactionRolledbackException, the client knows for certain that the transaction has been marked for rollback. It would be fruitless for the client to continue the transaction because the transaction can never commit.

12.4.2.2 javax.transaction.TransactionRequiredException

The javax.transaction.TransactionRequiredException is a subclass of the java.rmi.RemoteException. It is defined in the JTA standard extension.

The javax.transaction.TransactionRequiredException informs the client that the target enterprise bean must be invoked in a client’s transaction, and that the client invoked the enterprise bean without a transaction context.

This error usually indicates that the application was not properly formed.

12.4.2.3 java.rmi.NoSuchObjectException

The java.rmi.NoSuchObjectException is a subclass of the java.rmi.RemoteException. It is thrown to the client if a remote business method cannot complete because the EJB object no longer exists.

12.5 System Administrator’s responsibilities

The System Administrator is responsible for monitoring the log of the non-application exceptions and errors logged by the Container, and for taking actions to correct the problems that caused these exceptions and errors.

12.6 Differences from EJB 1.0

The EJB 1.1 specification of exception handling preserved the rules defined in the EJB 1.0 specification, with the following exceptions:

EJB 1.0 specified that the enterprise bean business methods and container-invoked callbacks use the java.rmi.RemoteException to report non-application exceptions. This practice

is deprecated in EJB 1.1—the enterprise bean methods should use the javax.ejb.EJBException, or other suitable RuntimeException to report non-application exceptions.

In EJB 1.1, all non-application exceptions thrown by the instance result in the rollback of the transaction in which the instance executed, and in discarding the instance. In EJB 1.0, the Con-

197

11/24/99

Sun Microsystems Inc.

Exception handling

Enterprise JavaBeans v1.1, Final Release

Differences from EJB 1.0

tainer would not rollback a transaction and discard the instance if the instance threw the java.rmi.RemoteException.

In EJB 1.1, an application exception does not cause the Container to automatically rollback a transaction. In EJB 1.0, the Container was required to rollback a transaction when an application exception was passed through a transaction boundary started by the Container. In EJB 1.1, the Container performs the rollback only if the instance have invoked the setRollbackOnly() method on its EJBContext object.

11/24/99

198