Hi


2014-09-02 22:37 GMT+02:00 Lars-Fredrik Smedberg <[email protected]>:
> 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?
>

right, even checked exceptions actually

> 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?
>

normally nothing you can see

> 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)?
>

IIRC yes

> 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?
>

should be called for it

> 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?

app exception are checked ones and defined ones @ApplicationException
or xml equivalent

> 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?
>

just log.erreor IIRC

> 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?
>

IIRC yes you'll only see java exception (your methods ones) but not
EJBException (client/caller view)

> 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 [email protected], and destroy all copies of this
> message and any attachments.

Reply via email to