This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Web Services and the fly likes Resteasy in-built exceptions not caught in the exception mapper Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Resteasy in-built exceptions not caught in the exception mapper" Watch "Resteasy in-built exceptions not caught in the exception mapper" New topic
Author

Resteasy in-built exceptions not caught in the exception mapper

Remya Mn
Greenhorn

Joined: Apr 20, 2012
Posts: 1
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
 
Don't get me started about those stupid light bulbs.
 
subject: Resteasy in-built exceptions not caught in the exception mapper
 
Similar Threads
java.lang.Class NotFoundException
javax. naming.Name NotFoundException
Exception
try catch block
Exception