There are two things I'm trying to achieve. I'm using RestEasy from JBoss 6.0.0.Final.
First is to turn off the logging for NotFoundExceptions thrown in ResteasyHandlerMapping. Despite my log4j.xml reading;
<level value="off" />
ResteasyHandlerMapping class still reports the error. I've ensured that LOG4J or SLF4J are specified in the "resteasy.logger.type" web.xml context-param, but neither work. The exception is still logged, as below;
16:01:48,441 WARN [org.jboss.resteasy.springmvc.ResteasyHandlerMapping] Resource Not Found: Could not find resource for relative : /invalid
/endpoint of full path: http://aserver/invalid/endpoint: org.jboss.resteasy.spi.NotFoundException: Could not find resource for
relative : /invalid/endpoint of full path: http://aserver/invalid/endpoint
at org.jboss.resteasy.core.registry.RootSegment.matchChildren(RootSegment.java:360) [:]
at org.jboss.resteasy.core.registry.RootSegment.matchRoot(RootSegment.java:374) [:]
at org.jboss.resteasy.core.registry.RootSegment.matchRoot(RootSegment.java:367) [:]
Secondly, I'd like to handle the exception and return a more meaning response. I've created and registered an exception mapper as per the example below;
@Provider public class NotFoundExceptionMapper implements ExceptionMapper<org.jboss.resteasy.spi.NotFoundException>
And it's registered in the class with the web.xml context-param "resteasy.providers", and specified in Spring as a bean.
Again, the exception mapper is never used to handle the exception and ultimately produces some HTML reporting a 404.
I've other exception mappers that work fine in capturing different exceptions thrown within an end point - so I'm assuming general exception mappers are fine, but despite the documentation claiming "You may override Resteasy built-in exceptions by writing an ExceptionMapper for the exception." - I can't seem to get exception mappers to handle internal RestEasy exceptions.
Any help would be gratefully appreciated.
Have you found a solution yet? I also face the same issue now. We used to have exception mappers that work correctly(to wrap 500 errors in a 200 error) before integrating with Spring. Now, after spring integration, this wrapping of 500 in 200 is not working. The closest I have come to is this post: http://stackoverflow.com/questions/5036166/springmvc-resteasy-and-exception-mapping
I haven't been able to take a stab at it again.
f you have any useful update, please let me know.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.