Servlet.init() called two times
1 posts in topic
Flat View  Flat View

Posted By:   Sameer_Nigade
Posted On:   Friday, January 28, 2005 11:31 AM

I deployed my application webapps/MyAppDir and in server.xml, I am setting
When configure Servlet in web.xml for loaded on startup with
1 the init() method of the servlet is called 2 times.

When I deploy my application to webapps/ROOT instead of webapps/MyAppDir and in server.xml , then it calls init() method once.

But for future development purpose, I would like to deploy my application in different directory or rather deploy just war. Is there any work around or setting by which I will able to do this?

Re: Servlet.init() called two times

Posted By:   priya_soparkar  
Posted On:   Tuesday, February 8, 2005 02:24 AM

Would like to know few things about your application deployment descriptor,

1) Tomcat version you have been using

2) Servlet entry in your web.xml (Assuming you are keeping your application's web.xml file in the WEB-INF directory under your application directory.)

Please understand the significance of load-on-startup parameter for numbers 0,1,.. in Tomcat 5.X versions.

Make sure that ServletException is not thrown in some perticular condition in your servlet code.

Servlet engine will call init method whenever ServletException is thrown and till the time servlet is placed into memory.

This is just a probable reason.

Exact thing could be told if you paste your entries in web.xml as well as server.xml deployment descriptor files.


About | Sitemap | Contact