Of course, the other detail is the definition of "Is Tomcat Running".
Firstly, Tomcat knows how to talk to "itself" through a management socket of somekind, is that protocol documented anywhere? That protocol is what is used to shut down Tomcat remotely. If that protocol is documented, that would tell you "Tomcat, the container, is alive". Then you'd probably like something that tells you your Webapp is running, that can be one of the JSPs already mentioned. Finally, you might like to know if the DB that your Webapp is talking to is running. That can be another JSP. You want to have a tiered system of checking things. For example, your detection routine can check 4 things: 1) DB JSP -> If this comes back, the DB, your App, Tomcat and Apache (if you're using it) are running. 2) Simple JSP -> Call this if the first fails, it tells you that your webapp is ok, and that your DB is sick. 3) Tomcat Heartbeat -> This says the container is alive, but your webapp is dead (didn't deploy or whatever) 4) Simple static HTML -> This says Apache is alive and well. You call them in the order and stop on success. No reason to call the rest as they have to be working in order to have the more complicated ones work. But as others said, they need to say "something" that you're looking for. A simple thing is to pass a parameter on the URL and have it echoed back, and have that token change for each status. Regards, Will Hartung ([EMAIL PROTECTED]) ----- Original Message ----- From: "Turner, John" <[EMAIL PROTECTED]> To: "'Tomcat Users List'" <[EMAIL PROTECTED]> Sent: Monday, July 08, 2002 6:28 AM Subject: RE: How to detect whether Tomcat is running? Right...a better method than checking the content length would be to create a JSP page that simply outputs a status string such as "Application OK" or whatever. Then look for that string in the content that comes back. Just checking for content to come back doesn't tell you that everything is OK, as Ralph pointed out. An error page will have a content lenght greater then -1 or greater than zero. John Turner [EMAIL PROTECTED] -----Original Message----- From: Ralph Einfeldt [mailto:[EMAIL PROTECTED]] Sent: Monday, July 08, 2002 9:25 AM To: Tomcat Users List Subject: AW: How to detect whether Tomcat is running? If you don't change it, the jsp engine always sends content length = -1, as it don't knows how long the output will get at the time it creates the header. So it is better to read the stream and parse the result for the status code. Note taht the content length may be > -1 if an error happens because tomcat or the web server might reply with an error page. > -----Urspr�ngliche Nachricht----- > Von: Jack Li [mailto:[EMAIL PROTECTED]] > Gesendet: Montag, 8. Juli 2002 15:01 > An: '[EMAIL PROTECTED]' > Betreff: How to detect whether Tomcat is running? > > > I need to detect the Tomcat status on a production server. I > was trying to run a detecting program on the development > server. If Tomcat is down on the production sever, I would > get an email. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
