Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Checking if Tomcat is up and running.

 
Ebenezer Aniapam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ebenezer Aniapam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then what is your definition of "up"?
 
Ebenezer Aniapam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic