0

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.

4

1 回答 1

0

ExceptionMapper impl 类捕获异常,而不是让自定义错误页面从 web.xml 中解析

解决方案是删除 ExceptionMapper impl 类。

于 2013-08-22T16:41:07.200 回答