> -----Original Message----- > From: Sergey Beryozkin [mailto:[email protected]] > Sent: Monday, March 14, 2011 5:29 AM > To: [email protected] > Subject: Re: Getting NPE without stack trace while rendering, with no > Spring context > > > Can you please try and register a custom JAXBElementProvider with the > > JAXRSServerFactoryBean ? This provider will only extend > writeTo/ReadFrom and > > will have a try/catch block around super.writeFrom and readFrom ? > > I'll check the JAXBElementProvider, I think it has few catches for > > different types of exceptions including the Exception class - and in > this > > case it should indeed print a stacktrace...Letting users to configure > the > > default WebApplicationExceptionMapper for it to print the stacktraces > is > > another option... > > > > > I updated the code accordingly, but in meantime the easiest option to > catch > the origin of the exception is to actually register a custom > WebAplicationExceptionMapper, i.e, > ExceptionMapper<WebApplicationException> > implementation (as a provider on the JAXRSServerFactoryBean) and then > just > print the stack trace
Ok, by "register", you mean to define the class and then put a bean reference to it in the "jaxrs:providers" list? I actually already had one defined and registered in that list. The "toResponse()" method was returning null. I added a statement before the return to log the stack trace. I set a breakpoint on that line. I reran my test case. It never hit the breakpoint, and thus never logged the stacktrace.
