I just joined a new company and it was told that the sites they have uses tomcat. And, they want to show a custom web page when tomcat is down. currently it will show Error 500. I am the only person in IT team for now and I am pretty new to tomcat and do not have knowledge about tomcat. Can someone please explain how to setup a custom web page when tomcat is down?I am using only tomcat not apache or load balancer infront of tomcat. Thanks in advance.
2 Answers
You have to use apache 2 or load balncer in front of tomat.And configure a maintenance page in apache or load balancer.
If you have any problem just post it

- 503
- 1
- 8
- 20
This answer may not the correct way but hope it will help to the folks who do not want to use (or not allowed as in my case) apache 2 or load balancer in front of Tomcat server. This solution is for Tomcat servers that contains only one application instance.
I also had a similar problem and they expected a solution without having apache 2 or load balancer in front of tomcat (because it’s a live project and they do not want to change the architecture).
I used two instances of Tomcat server to come up with a solution. The OS is windows and Tomcat server configured as a windows service.
I copied the Tomcat server and create another windows service for this new server. Then I created a dummy project (war file name is same as the original project name) with maintenance html file and deployed it in the new Tomcat server.
Finally created two batch files, one for stop the main Tomcat server and start the maintenance Tomcat server and other one to reverse this process. So once you execute the batch file it will stop the main Tomcat server and bring up the maintenance Tomcat server.
Below is a sample can use in batch file.
@echo off
echo Main Tomcat server will stop
NET STOP "Tomcat9"
echo Maintenance Tomcat server will Start
NET START "Tomcat9-MAINTENANCE"
PS: We can use these batch files in Windows Task schedulers also.

- 980
- 1
- 8
- 15