Custom 500 error page not working with JBoss AS 7.1.1

家住魔仙堡 提交于 2019-12-23 05:45:17

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/16694675/custom-500-error-page-not-working-with-jboss-as-7-1-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!