On Jul 24, 2009, at 2:59 AM, Paul Sandoz wrote:
> Hi Herak,
>
> Well observed!
>
> We also found this out as well but i am not sure how to solve it.
>
> 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.
> Paul.
>
> On Jul 23, 2009, at 5:31 PM, Herak Sen wrote:
>
>> Hi,
>>
>> when I throw WebApplicationException from resource class, it’s
>> always caught as EJBException, thus the client get wrong http error
>> code (500).
>>
>> @Stateless
>> @Path("/testrs")
>> public class TestResource{
>>
>> @GET
>> public void throwExc(){
>>
>> throw new WebApplicationException();
>>
>> }
>> }
>>
>> I guess this should not be the expected behavior.
>>
>> Thanks
>> Herak
>>
>>
>>
>