> 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.