Regarding loading a class on startup

2001-06-19 Thread Pankaj Chhaparwal

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




Re: Regarding loading a class on startup

2001-06-19 Thread Bo Xu

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





Re: Regarding loading a class on startup

2001-06-19 Thread Boris Niyazov

If your class is a servlet you may want to use 
load-on-startup
 1
/load-on-startup

in your web.xml
hth
*
* Boris NiyazovPh:  212-854-4094  Fax: 212-854-1749 *
* Systems Manager  Email: [EMAIL PROTECTED] * 
* Columbia Law School  URL: http://www.law.columbia.edu *
*  
 



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


  - Boris