Scenario:
Apache Tomcat 6.0 is started as a service on Windows Server 2008 R2 using a wrapper (org.tanukisoftware.wrapper.WrapperStartStop
) which uses org.apache.catalina.startup.Bootstrap
. In course of the Tomcat startup one web application is also started.
This web application needs to connect to a remote database and check the connection. It retries to connect a couple of times if the database is not available and then shutsdown after x tries.
Problem:
I need to stop Apache Tomcat after the webapp exits when the database connection is not available.
Possible solutions:
- Stop Apache Tomcat from within the web application (already tried the shutdown port which did not work because the connection was refused - with a standalone java application it worked)
- Call an external Java application from within the web application
- Configure Apache Tomcat to shutdown if the only web application shuts down - I could not find a way to do that
Any ideas? Maybe a different approach?
regards
Alexander