You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jovie Castaneda <jo...@pure-commerce.com> on 2001/10/22 01:31:41 UTC

servlet in startup

Hi guys,

  Can someone please help me how to make my servlet run when the Tomcat
starts up. What do I have to do in my codes
to impelement this or some setup needed for my Tomcat config.?
Thanks in advance



Re: servlet in startup

Posted by "Dr. Evil" <dr...@sidereal.kz>.
>   Can someone please help me how to make my servlet run when the Tomcat
> starts up. What do I have to do in my codes
> to impelement this or some setup needed for my Tomcat config.?


Put these lines in web.xml:

   <servlet>
      <servlet-name>startlogging</servlet-name>
      <servlet-class>startlogging</servlet-class>
      <load-on-startup>1</load-on-startup>
   </servlet>

The number in the load-on-startup tag specifies the order of loadup.

In your servlet, put the code that you want to run on startup in the
init() method.  It will be called in the order listed in the web.xml
on server startup.  It works.  I use it to start log4j and to start my
database connection pool.

Re: servlet in startup

Posted by Dmitri Colebatch <di...@bigpond.net.au>.
Look at the load on startup flag in web.xml

hth
dim

On Mon, 22 Oct 2001, Jovie Castaneda wrote:

> Hi guys,
> 
>   Can someone please help me how to make my servlet run when the Tomcat
> starts up. What do I have to do in my codes
> to impelement this or some setup needed for my Tomcat config.?
> Thanks in advance
> 
> 
>