File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How to check web server is running properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to check web server is running properly" Watch "How to check web server is running properly" New topic
Author

How to check web server is running properly

lily zou
Ranch Hand

Joined: Jan 15, 2002
Posts: 50
Hi, there

I need to create a heartbeat program to periodicly check if a web server and a servlet engine ( Apache & tomcat) is running properly . The two way I thought is
1. to send HTTPRequest through command line and check if it can be handled properly. ( but how to issue this command and how to delete the sessions created by this kind of process ? )
2. to check pid contends to see if those two processes are running ( is it possible that a stale process could be detected and reported ? )
Any advice would be great appreciated.
Lily
Sean MacLean
author
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
Put a test servlet somewhere on the site. Write a stand alone application that connects to the servlet using a URLConnection (i.e. checks to see if the server is listening on port 80, for instance) and see it the servlet responds. The various statuses, 500 errors, etc that you'll get back should tell you what you need to know. Checking to see if the server process is running doesn't tell you if actual requests are getting processed (which is the bottom line really).
lily zou
Ranch Hand

Joined: Jan 15, 2002
Posts: 50
Thank you very much,Sean.
By the way, I am wondering if a process died, its process id would be gone. Is it correct ? Is there any possiblity that a process id hangs around even after the process it represents has died ?
Thanks again.
Lily
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to check web server is running properly