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:
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!
Jersey code example:
@GET
public SomeObject getServiceModule() throws Exception
{
// Note: Hopefully SomeObject can marshal correctly because
// jersey will ignore any exceptions after the object was created.
return SomeObject(42);
}
/Cheers,
Morten
Find din nye laptop på kelkoo.dk. Se de gode tilbud her -
http://dk.yahoo.com/r/pat/mm