I have a JAX-RS application deployed on JBoss AS 7.1.1. In the web.xml file I configured custom error pages:
<error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error.jsp</location>
</error-page>
It's working ok for 404 (no found) errors. However, for 500 (internal server error), it doesn't work as expected:
- if my method throws an Exception, then my custom error page is displayed
- however, if I use in my method return Response.serverError.build() or return Response.status(500).build() then the default JBoss error page is displayed instead of my custom one!
How can I fix this? Thank you for your answers.
ExceptionMapper impl class catches the exception instead of letting the custom error page to be resolved from web.xml
The resolution would be to remove the ExceptionMapper impl class.