How can I load an arbitrary class on startup in Tomcat?
I saw load-on-startup
tag for web.xml
file, but can I use it and how should I implement my
enfix,
Your XML looks good.
You should place a init() method in your servlet class, that gets called when your server bootsup. doGet, doPost and do methods get called only when there is an incoming request.
public class YourServlet extends HttpServlet
{
public void init()
{
//initialize( or add a log statement to debug)
}
}