wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Checking if Tomcat is up and running. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Checking if Tomcat is up and running." Watch "Checking if Tomcat is up and running." New topic
Author

Checking if Tomcat is up and running.

Ebenezer Aniapam
Greenhorn

Joined: Mar 11, 2008
Posts: 5
We using Tomcat 5.4.2.0 as a remote application server. The web application code is ASP. I need to add an error code in the ASP to check when the Tomcat server goes down and also to show on start if the server is up and running. Any help please
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42360
    
  64
The web app could make an HTTP call to Tomcat's home page every minute or so, and -depending on whether it gets a 200 response or something else- act accordingly.


Ping & DNS - my free Android networking tools app
Ebenezer Aniapam
Greenhorn

Joined: Mar 11, 2008
Posts: 5
Ulf Dittmer wrote:The web app could make an HTTP call to Tomcat's home page every minute or so, and -depending on whether it gets a 200 response or something else- act accordingly.





I know it is possible to do an HTTP GET on the root url, but that is not accurate. Any other option?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42360
    
  64
Then what is your definition of "up"?
Ebenezer Aniapam
Greenhorn

Joined: Mar 11, 2008
Posts: 5
Ebenezer Aniapam wrote:We using Tomcat 5.4.2.0 as a remote application server. The web application code is ASP. I need to add an error code in the ASP to check when the Tomcat server goes down and also to show on start if the server is up and running. Any help please


I have found an an example from Vadivel Murugesan using Socket Ports. Although it is application dependency, that is what I am looking.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
Why not make that a complete status report GET - protected with passwords of course. You could recover number of requests processed, memory use, most recent error, etc.

Bill
Ebenezer Aniapam
Greenhorn

Joined: Mar 11, 2008
Posts: 5
Ebenezer Aniapam wrote:We using Tomcat 5.4.2.0 as a remote application server. The web application code is ASP. I need to add an error code in the ASP to check when the Tomcat server goes down and also to show on start if the server is up and running. Any help please

Hi William, Do you have an example of what you are saying. That sounds perfect. If you can email me an example that will help
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12809
    
    5
My example is excessively complex to demonstrate the concept so here is pseudo-code

in the doGet method

1. check the request parameters for a key word or set of words - if not found do normal processing
for security, additional verification could look at the IP the request comes from
2. we now know we have a management request - using the key word, decide what kind
3. generate the management data response - could be a HTML page or XML or whatever you need
4. close output stream and return

Bill
Ebenezer Aniapam
Greenhorn

Joined: Mar 11, 2008
Posts: 5
Ebenezer Aniapam wrote:We using Tomcat 5.4.2.0 as a remote application server. The web application code is ASP. I need to add an error code in the ASP to check when the Tomcat server goes down and also to show on start if the server is up and running. Any help please


Hi William,
Thanks. I got it working perfectly correct the way I want it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Checking if Tomcat is up and running.