|
Re: Tomcat and Apache Living Together, Mass Hysteria
|
Posted: Nov 13, 2002 4:41 PM
|
|
Occasionally when Tomcat crashes, Apache seems to get confused and forget it is supposed to pass JSP requests onto the now non-existant Tomcat. Usually, when Tomcat goes away, Apache returns a "Server Error" page on JSP requests. But occasionally, it returns the raw JSP page code.
One of the system administrators of my service provider suggested that most likely this is not caused by Apache being restarted with the wrong config file, but that the Apache process running when Tomcat crashes is probably just getting screwed up, which causes it to start serving up raw JSP source.
What I am planning to do to address this issue is put a JSP comment with some random text string in the home page, and create a script to run as a cron job every 5 minutes or so. The script will check to make sure the home page can be retrieved via http. If not, it will attempt to restart things. If so, it will check the page returned for the JSP comment. If it finds it, that means Apache is serving up raw JSP code again, and it will also attempt to restart things. I'll probably also have the script send emails to the sys admins, so they can check and make sure all looks well.
Or, I could just change my attitude and advertise this as a feature. Artima.com could be a site where not only can you read interesting articles and exchange ideas with other developers, but from time to time, you can see examples of real JSP code. Very educational.
|
|