tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Jacquemont <benoit.jacquem...@smile.fr>
Subject Re: instanciate a servlet when tomcat starts
Date Wed, 09 May 2001 16:45:31 GMT
Hi Sandrine,

You have to change (or create if doesn't exist) the web.xml file that comes 
in the WEB-INF directory.

The example below is the entire content of a web.xml file that loads the 
ServletInit servlet and instantiate it (to the name defined by servlet-name) 
on startup. The load-on-startup property must be different than 0 to have the 
servlet loaded and instantiate at the startup of the app (when tomcat starts).

Benoit

<?xml version="1.0" encoding="ISO-8859-1"?>
 
<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
    <servlet>
        <servlet-name>ServletInit</servlet-name>
        <servlet-class>ServletInit</servlet-class>
        <load-on-startup>-1</load-on-startup>
    </servlet>
</web-app>


> Hi,
>
> I've a servlet that loads properties from a file to load them in the System
> properties.
> I'd like this servlet to be instanciated when Tomcat starts.
> With Jserv, i used the zone.properties file.
> I think it must be simple, but i really don't now tomcat and all the
> configuration file!
>
> Thanks
>
> Sandrine

Mime
View raw message