dev@jsr311.java.net

EJBException handling spec error

From: Bill Burke <bburke_at_redhat.com>
Date: Tue, 06 Jul 2010 09:39:11 -0400

The spec says: "If an ExceptionMapper for EJBException or subclass is
not included with an appliction, then exceptions thrown by an EJB
resource class or provider method MUST be treated as an EJB application
exception..."

An "application exception" in EJB means that the thrown exception will
not automatically cause a rollback and should be propagated as-is.
Following this JAX-RS/EJBException logic to the letter of the law would
make it impossible for EJB applications to throw exceptions that cause
transaction rollbacks.

The EJB container wraps unchecked (non applicaton) exceptions within
EJBException. Unchecked exceptions are required by the EJB
specification to trigger a rollback unless they are annotated with
@ApplicationException or ejb-jar.xml equivalent.

The spec should instead just say:

"If an ExceptionMapper for EJBException or subclass is not included with
an appliction, then EJBException thrown by an EJB resource class or
provider method MUST be unwrapped and processed as described in section
3.3.4"

-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com