tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shapira, Yoav" <>
Subject RE: ServletContextListener fails - how to make app unavailable?
Date Thu, 11 Sep 2003 16:55:24 GMT

The general answer for cases like this is wrap the exception in a
RuntimeException or it's subclass.  So,

... contextInitialized(ServletContextEvent sce) {
  try {
  } catch (Exception e) {
    // Make tomcat mark this context as unavailable
    throw new RuntimeException(e);

Yoav Shapira
Millennium ChemInformatics

>-----Original Message-----
>From: Sasha Borodin []
>Sent: Thursday, September 11, 2003 12:52 PM
>To: Tomcat Users List
>Subject: ServletContextListener fails - how to make app unavailable?
>I've tried searching for this issue in the tomcat-user archives; I
>general theory but not how to implement it.  Specifically:
>If there's a problem within contextIntitialized(), I would want the app
>return HTTP 500 or something.  But the ServletContextListener interface
>not declare any Exceptions thrown.  Thus I can't declare any in my
>Yet if I try to just catch an Exception, log, and rethrow a general
>ServletException, I can't compile cause ("must handle or declare...").
>So how do I notify Tomcat that there's a problem, and that the context
>should be made unavailable?
>To unsubscribe, e-mail:
>For additional commands, e-mail:

This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged.  This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else.  If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender.  Thank you.

View raw message