tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yoav Shapira" <>
Subject Re: How to load a static class on Tomcat startup
Date Fri, 01 Jun 2007 15:53:11 GMT
Use ServletContextListener's contextInitialized method.  In it you can
do your Class.forName call or whatever other way you want to load the
class.  This is portable and doesn't depend on Tomcat's internal

Also, this is not a question for the dev mailing list, but for the
users mailing list.  Please see
and if you have follow-up questions, post them on the users mailing
list.  Thanks,


On 6/1/07, <> wrote:
> Hello everybody,
> I want to know how I can configure Tomcat to load a Singleton class on his
> startup routine? This class implement a cache that I want to stay in memory
> until Tomcat is shutted down.
> I've read about context but it seem to load the class only on a particular URL
> request..
> I want the class to be loaded with Tomcat, without any request is made.
> Thanks to all
> Andrea
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message