Custom 500 error page not working with JBoss AS 7.

2019-06-12 03:26发布

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.

标签: jboss7.x
1条回答
The star\"
2楼-- · 2019-06-12 04:06

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.

查看更多
登录 后发表回答