I have customized error code 403 (client error) through webapp i.e. adding entry in web.xml as below which works fine.

<error-page>
    <error-code>403</error-code>
    <location>/access-denied.xhtml</location>
</error-page>

I try to customise error code 500 (server error) with the above approach as below.

<error-page>
  <error-code>500</error-code>
  <location>/error-500.xhtml</location>
</error-page>

but this doesn’t work (getting jboss's original error message for error code 500 instead of error-500.xhtml) and I have no clue why, so I am left with only option to customize it through apache httpd and vhost config. Any idea why this is not working?

有帮助吗?

解决方案

The reason for not working is because the webapp has implemented ExceptionMapper that 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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top