0
votes

I want to suppress the stack trace shown by tomcat when 500 internal server is occurred. I have included a custom error.html page and mentioned the file location and error-code in web.xml.

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

After making the above changes , for all the API's tomcat is returning 404 Not Found.

1

1 Answers

0
votes

Inside web.xml, add something like this:

<error-page>
    <error-code>400</error-code>
    <location>/WEB-INF/jsp/errorpages/ErrorPage400.jsp</location>
</error-page>
<error-page>
    <error-code>401</error-code>
    <location>/WEB-INF/jsp/errorpages/ErrorPage401.jsp</location>
</error-page>
<error-page>
    <error-code>403</error-code>
    <location>/WEB-INF/jsp/errorpages/ErrorPage403.jsp</location>
</error-page>
<error-page>
    <error-code>404</error-code>
    <location>/WEB-INF/jsp/errorpages/ErrorPage404.jsp</location>
</error-page>
<error-page>
    <error-code>500</error-code>
    <location>/WEB-INF/html/error.html</location>
</error-page>



Path of HTML file should like /WEB-INF/html/error.html.