-
Bug
-
Resolution: Done
-
Major
-
2.3.5.Final
I have an ExceptionMapper<java.lang.Exception> that works in most cases except one:
If I POST to a method that throws an exception, I get the following Exception:
SEVERE: Servlet.service() for servlet [Frontend] in context with path [/resteasy-interceptor-demo] threw exception org.jboss.resteasy.spi.UnhandledException: org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: no.synth.resteasyinterceptordemo.MyExceptionMapper$Error of media type: application/x-www-form-urlencoded at org.jboss.resteasy.core.SynchronousDispatcher.writeFailure(SynchronousDispatcher.java:460) at org.jboss.resteasy.core.SynchronousDispatcher.executeExceptionMapper(SynchronousDispatcher.java:349) at org.jboss.resteasy.core.SynchronousDispatcher.unwrapException(SynchronousDispatcher.java:373) at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:362) at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233) at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209) at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722) Caused by: org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: no.synth.resteasyinterceptordemo.MyExceptionMapper$Error of media type: application/x-www-form-urlencoded at org.jboss.resteasy.core.ServerResponse.writeTo(ServerResponse.java:216) at org.jboss.resteasy.core.SynchronousDispatcher.writeJaxrsResponse(SynchronousDispatcher.java:602) at org.jboss.resteasy.core.SynchronousDispatcher.writeFailure(SynchronousDispatcher.java:447) ... 28 more
This also have the added "bonus" that it hides the original Exception from the logs.
I have a demo project that demonstrates the behaviour (at least in Tomcat 6 & 7) at https://github.com/henrik242/resteasy-interceptor-demo
- is related to
-
RESTEASY-814 RESTEasy Interceptor Related Issues Tracker Bug
- Closed
- relates to
-
RESTEASY-797 MessageBodyReaderInterceptor does not trigger for POST requests with MultivaluedMap parameter
- Resolved