users@jersey.java.net

Re: [Jersey] Problem: Jersey swallows all JAXP exceptions silently !

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Thu, 23 Jul 2009 22:37:21 -0700

On Thu, Jul 23, 2009 at 5:42 PM, Morten<mortench2004_at_yahoo.dk> wrote:
> Jersey calls into JAXP to marshall returned objects automatically. When it works, this is very nice as it allows clean code like the code below:

I think you mean JAXB, not JAXP?

> HOWEVER, if SomeObject marshalling fails due to a some problem inside SomeObject (f.x. a wrong annotation) then Jersey silently ignores the exception and simply returns an empty result. Even if I install an  ExceptionMapper for java.lang.Throwable.
>
> This is VERY, VERY annoying as it takes a LOT of time to diagnose and debug such cases. Jersey should not swallow (JAXP) exceptions. At least a valid registered ExceptionMapper should know of them so I can see it, log it and act on it!
...

Yes, this can be annoying. Sometimes it is beneficial to just handle
unmarshalling part yourself; it's just a line or two more code, but
you can customize error handling in much more detail.

-+ Tatu +-