i tried to handle the error code 503
in my application web.xml as follows:
<error-page>
<error-code>503</error-code>
<location>/serviceNotAvailable</location>
</error-page>
but it’s not working i don’t know why, please advise.
i am using apache,tomcat.
I was in similar situation and end up using apache in front of tomcat.
Ie when tomcat is down from some reason, Apache intercept the 503, and use httpd config
to redirect to your own custom page. Some details can be found here apache tomcat 503 custom error page.
503 is quite serious compared to 404 etc, most of time there are some un-recoverable error which crash the service/app, in our case heap-memory issues.
I would also be quite interested in anyone else comes up with how to redirect 503 from Tomcat alone.