Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Resteasy in-built exceptions not caught in the exception mapper

932222Apr 21 2012 — edited Apr 21 2012
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:

@Provider
public class NotFoundExceptionMapper implements ExceptionMapper<org.jboss.resteasy.spi.NotFoundExc eption>
{
@Override
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.

Regards,
RM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 19 2012
Added on Apr 21 2012
1 comment
1,160 views