Hi!

Maybe someone can shed a light on the following questions when it comes to
EJBException vs other non-aplication exceptions:

1. The EJB 3.1 spec says in 14.2.2 that any non-recoverable exceptions
caught or error that occurs in a bean method should be rethrown as an
EJBException but the tables in 14.3.1. talks about "any other exceptions"
which I interprete that I can throw any runtime exception from an EJB
method, not only EJBExceptions, correct?

2. If 1 above is correct, is there any difference in the container
responsibility function and/or performance wise if I choose to throw a
runtime exception (other than EJBException) or an EJBException?

3. Will the EJB container always wrap non-application exceptions (wether
they are runtime exceptions or not) in an EJBException and rethrow them to
the caller (client view)?

4. When an non-application exception is thrown I see that for all EJBs
except for Singleton EJBs the EJB instance is discarded. When its discarded
I understand that NO callback methods such as @PreDestroy is called. Is
there any way / hooks for doing cleanup?

5. In the EJB spec they talk about AppExceptions, "any other exceptions"
and "system exception". Does "any other exceptions" and "system exceptions"
refer to the same thing? If not what differs?

6. We use TomEE for development but some production servers run on
WebSphere (so this question might be little off topic). We see that any
runtime (no matter if its an EJBException or not) causes an FFDC log while
application exceptions do not. Is this because of the EJB spec saying that
the container should log "any other exceptions" (14.3.1)? An FFDC log seems
a bit hard, how does TomEE enterpretes this?

7. If a business method throws an application exception or "any other
exception" will I be able to catch that in an EJB interceptor or CDI
interceptor? I'm sure its in the spec somewhere but didn't see it when I
was looking now? I assume they are not called for "any other exception"
since the instance is to be discarded. If thats the case is it still called
for singletons?

Best Regards
Lars-Fredrik

-- 
Med vänlig hälsning / Best regards

Lars-Fredrik Smedberg

STATEMENT OF CONFIDENTIALITY:
The information contained in this electronic message and any
attachments to this message are intended for the exclusive use of the
address(es) and may contain confidential or privileged information. If
you are not the intended recipient, please notify Lars-Fredrik Smedberg
immediately at itsme...@gmail.com, and destroy all copies of this
message and any attachments.

Reply via email to