You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by André Warnier <aw...@ice-sa.com> on 2008/11/25 12:02:00 UTC

load-on-startup

Hi.

About the <load-on-startup> item in web.xml, the Servlet Spec 2.5 has 
this to say (p 128) :

The load-on-startup element indicates that this
servlet should be loaded (instantiated and have
its init() called) on the startup of the web
application. The optional contents of these
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 same load-on-start-up value.


My questions are :

1) In the case of Tomcat 5.5 and higher, is there a way to *prevent* a 
deployed application to be loaded and/or started at Tomcat startup ?
(basically only be started when the first call to it is made)

2) what is the interpretation of a missing <load-on-startup> tag ?

A related question :

Using the Tomcat Manager app, I can "stop" and "start" an application.
What really happens there, internally ?  What does it mean that an 
application is stopped ? Does it mean that from now on Tomcat somehow 
"catches" the calls to these URLs, and diverts them to some internal 
webapp that responds : no such application, or ?

Thanks.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: load-on-startup

Posted by Juha Laiho <Ju...@iki.fi>.
André Warnier wrote:
> Hi.
> 
> About the <load-on-startup> item in web.xml, the Servlet Spec 2.5 has
> this to say (p 128) :
[...]
> My questions are :
> 
> 1) In the case of Tomcat 5.5 and higher, is there a way to *prevent* a
> deployed application to be loaded and/or started at Tomcat startup ?
> (basically only be started when the first call to it is made)

I don't think so. However, if you don't have load-on-startup at all,
the servlets will only be loaded when first referenced. As to when
the JSP compilation happens, I'm not certain (but once compiled,
I think also the servlets that are generated from JSPs are only loaded
when first referenced). It seems that you're somewhat mixing loading
of a single servlet with loading of the whole webapp.

> 2) what is the interpretation of a missing <load-on-startup> tag ?

Looks like I answered this question in the above.

> A related question :
> 
> Using the Tomcat Manager app, I can "stop" and "start" an application.
> What really happens there, internally ?  What does it mean that an
> application is stopped ? Does it mean that from now on Tomcat somehow
> "catches" the calls to these URLs, and diverts them to some internal
> webapp that responds : no such application, or ?

A webapp has quite a bit of context, in addition to the servlets, JSPs
and static resources. This context is what is being built on startup
(and torn down when stopping the application). This context is described
in the per-application web.xml; context init parameters, context listeners,
declared servlet mappings, ... .
-- 
..Juha

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: load-on-startup

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: André Warnier [mailto:aw@ice-sa.com]
> Subject: load-on-startup
>
> 1) In the case of Tomcat 5.5 and higher, is there a way to *prevent* a
> deployed application to be loaded and/or started at Tomcat startup ?

Turn off the deployOnStartup attributes of the <Host> element.  Also consider turning off autoDeploy.
http://tomcat.apache.org/tomcat-5.5-doc/config/host.html#Automatic%20Application%20Deployment

> 2) what is the interpretation of a missing <load-on-startup> tag ?

Initialization when Tomcat feels like it, which should be at the first reference.

> Using the Tomcat Manager app, I can "stop" and "start" an application.

Stopped is deployed but inactive; requests return a 503 status (as opposed to a 404 when the webapp isn't deployed).  Webapps in a stopped state may be started or removed.  The normal cycle is:
  deploy --> start <--> stop --> undeploy
The initial transition from deploy --> start happens automatically when a webapp is deployed.

> What really happens there, internally ?

Juha L answered that succintly.  Gotta use all that space in the heap for something...

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org