-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris,

On 10/14/2009 11:11 AM, Chris Wiggins wrote:
> I'd like to configure Tomcat 5.5 to fail to start if any of its webapps
> fail to start. Is that possible? I can't find any configuration element
> in the documentation that suggestions that this can be done.

I don't believe Tomcat itself has any feature to do this, but you could
probably modify Tomcatg fairly trivially to do this.

To find out what Tomcat is doing on start-up (where, I believe, a single
thread is responsible for deploying /all/ webapps, one-at-a-time, in
arbitrary order), just add a ServletContextListener to your webapp and
implement this method:

public void contextInitialized(ServletContextEvent e)
{
   new Throwable("==== CONTEXT STARTING =====").printStackTrace();
}

This will emit a stack trace to stdout, which usually ends up in
logs/catalina.out. You'll see the full stack trace, from the Bootstrap
class all the way through your own code. You should be able to use that
to find an appropriate place in the Tomcat code to shutdown the JVM if
one of the webapps fails to load.

> Tomcat is just a small part of our system, and our start up sequence
> automatically aborts if any component fails to start. However, Tomcat
> generally always succeeds, even if one or more of the webapps it is
> running fails. You then only discover something is wrong when you hit a
> particular webpage.

Even if you implement the above strategy, you might still not get what
you want: how are you starting Tomcat? bin/catalina.sh puts Tomcat into
the background when it starts, so you won't be able to get any status
information from the process itself.

What is your plan for checking to see if Tomcat exited at all, with or
without an error code?

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrWEpMACgkQ9CaO5/Lv0PDwKQCeOIkl+CU/QxQcMPhwj3r+iuYy
e78AoKYnwbRQ1qfT6njX9AczbcGbrQDI
=d0nd
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to