You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Bo Xu <bo...@cybershop.ca> on 2001/06/19 21:23:04 UTC

Re: Regarding loading a class on startup

Pankaj Chhaparwal wrote:

> Hi,
> I want to load a class in the memory when the tomcat server starts.
> Basically this class has some static data which I want the application to
> use. I want to keep the data at application level.
>
> Regards,
> Pankaj

Hi :-)

- in Servlet spec2.3, there is a new feature about "application lifecycle
  events":  ServletContextListener interface, please see the following link:
  http://www.javaworld.com/javaworld/jw-01-2001/jw-0126-servletapi_p.html

-  now I don't know which CL(classloader) will load a class which implements
  ServletContextListener, so I think it is "context level", but I am not sure
if it
   is "container level(cross several-contexts in the same container)".

- I have a question:
   where can I put this listener-class?
   in WEB-INF/classes?  or wrap it in a jar file and put the jar file in
WEB-INF/lib?
   can I put it in TOMCAT_HOME/lib(loaded by ShareCL)

- there is also another  new feature in Servlet spec2.3:  HttpSessionListener




Bo
June 19, 2001