users@jersey.java.net

RE: [Jersey] Jersey EJB exception

From: Herak Sen <HSen_at_vertrax.com>
Date: Fri, 28 Aug 2009 10:33:11 -0400

Hi Paul,

I just tested and it's working.
I was just wondering how did you fix it?

Herak

-----Original Message-----
From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
Sent: Wednesday, August 26, 2009 8:38 AM
To: users_at_jersey.dev.java.net
Cc: Herak Sen; Kenneth Saks
Subject: Re: [Jersey] Jersey EJB exception


On Jul 27, 2009, at 2:52 PM, Marc Hadley wrote:

> On Jul 27, 2009, at 3:46 AM, Paul Sandoz wrote:
>>>>
>>>> Ken, in such cases would it be sufficient for Jersey to process
>>>> an EJBException like an InvocatonTargetException such that the
>>>> underlying target exception can be processed ?
>>>>
>>>
>>> No, EJB makes a distinction between application exceptions and
>>> system exceptions. WebApplicationException must be a runtime
>>> exception so it's considered a system exception and results in an
>>> EJBException that won't necessarily directly chain the original
>>> cause. If the thrown exception is a subtype of
>>> java.lang.Exception or is annotated with
>>> @javax.ejb.ApplicationException, it will be treated as an
>>> application exception and received exactly as thrown.
>>>
>>
>> I suppose a developer could extend WebApplicationException and
>> annotate it, but that is not really the expected thing to do.
>>
>> Do we need a little SPI to declare to the EJB container that
>> WebApplicationException should be treated as if it is annotated
>> with @javax.ejb.ApplicationException?
>>
>> Marc, do we need to do something in the JAX-RS spec? either state
>> the restriction, or based on Ken's advice, that it should be
>> supported.
>>
> I think we need WebApplicationException to be treated as an
> application exception even though its a runtime exception not
> annotated with @ApplicationException. I can add something to that
> effect to the spec but then I guess you'll need that SPI.
>

This is fixed in the 1.1.2-ea release.

Paul.