Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Resteasy in-built exceptions not caught in the exception mapper  RSS feed

Remya Mn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends,

I have written some exception mappers to catch and handle the in-built rest easy exceptions like NotFoundException,MethodNotAllowedException, etc., Sample code as shown:

public class NotFoundExceptionMapper implements ExceptionMapper<org.jboss.resteasy.spi.NotFoundExc eption>
Response toResponse(org.jboss.resteasy.spi.NotFoundExceptio n exception) {
return Response.status(500).build();

I have also written a try catch block in my web filter class. Whenever a NotFoundException occurs, it is not caught in the mapper, but it goes to the catch block in the Filter.

Whereas I have tried another exception mapper class to handle JsonParsingException. This is working correctly and giving a proper response from the mapper whenever a Json Parse exception occurs.

The issue is only with the case of resteasy inbuilt exceptions.
Also, the Provider has been registered in the application context using the include-filter tag inside component scan.
Is there any additional configuration to be done for this?

Please guide me as to what needs to be done to catch rest easy in-built exceptions in the mapper class itself.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!