You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by mers <ef...@gmail.com> on 2007/03/24 20:48:43 UTC

How do I handle failure in contextInitialized()?

Hi,

I have a class that implements ServletContextListener. When I receive a
contextInitialized() call, I need to load some data from a database and add
it to the application scope for subsequent use by various servlets and
pages.

There is a chance that the database request made in contextInitialized()
either fails to connect to the database or does not find the relevant data.
If that's the case, I'd like the context to not load, preferably gracefully,
but ungracefully if need be.

Is that possible?

Thanks,
Emerson
-- 
View this message in context: http://www.nabble.com/How-do-I-handle-failure-in-contextInitialized%28%29--tf3459960.html#a9653570
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: How do I handle failure in contextInitialized()?

Posted by Mikolaj Rydzewski <mi...@ceti.pl>.
mers wrote:
> There is a chance that the database request made in contextInitialized()
> either fails to connect to the database or does not find the relevant data.
> If that's the case, I'd like the context to not load, preferably gracefully,
> but ungracefully if need be.
>   
If you throw an exception application will not be available.

-- 
Mikolaj Rydzewski      <mi...@ceti.pl>        http://ceti.pl/~miki/
                    PGP KeyID: 8b12ab02
There are three kinds of people: men, women and unix.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org