Get your CodeRanch badge!*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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: 39536
    
  27
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 - updated with new look and Ping home screen widget
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: 39536
    
  27
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: 12675
    
    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

Java Resources at www.wbrogden.com
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: 12675
    
    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.
 
Similar Threads
Redirection
Is Tomcat an application server?
Calling JSP from ASP
Does Sun One ASP run .jsp?
Tomcat 4.1 - Setting Folder Read/Write Permission