You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jack Li <JL...@MurraysDiscount.com> on 2002/07/08 15:00:33 UTC

How to detect whether Tomcat is running?

Hi all,
 
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. I wrote the following codes in my
detecting program. I tried to connect the main.jsp page on the production
server. But I always got the content length -1. Any good ideals to solve
this program?
 
URL url=new URL(  <http://production_server/prog/>
http://production_server/prog/main.jsp);
URLConnection con = url.openConnection();
con.connect();
int iLength = con.getContentLength();
            
 
Thanks,
Jack Li