I am getting a bit confused here. In our application we are having a few servlets defined. Here is the excerpt from the web.xml
for one of the servlets:
<servlet>
<servlet-name>AxisServlet</servlet-name>
<display-name>Apache-Axis Servlet</display-name>
<servlet-class>com.foo.framework.axis2.http.FrameworkServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
As per my understanding the value for the <load-on-startup>
has to be a positive integer in order for it to get loaded automatically. I looked up on google but the responses I came across only added to my confusion.
Resin 3.0 documents this behavior:
load-on-startup can specify an (optional) integer value. If the value is 0 or greater, it indicates an order for servlets to be loaded, servlets with higher numbers get loaded after servlets with lower numbers.
The JSP 3.1 spec (JSR 340) says this on page 14-160:
The element
load-on-startup
indicates that this servlet should be loaded (instantiated and have its init() called) on the startup of the Web application. The element content of this element must be an integer indicating the order in which the servlet should be loaded. If the value is a negative integer, or the element is not present, the container is free to load the servlet whenever it chooses. If the value is a positive integer or 0, the container must load and initialize the servlet as the application is deployed. The container must guarantee that servlets marked with lower integers are loaded before servlets marked with higher integers. The container may choose the order of loading of servlets with the sameload-on-startup
value.
You probably want to check not only the JSR, but also the documentation for your web container. There may be differences