Specifying when servlets are loaded and initialized

By default, the Liberty profile defers servlet loading until a request is received for the associated web application. You can override this default behavior by specifying the web container deferServletLoad attribute to false.

About this task

The servlet specification defines the load-on-startup servlet attribute, which is specified in the web.xml file of a web application. If a servlet has a non-negative value for the load-on-startup attribute, the servlet must be loaded and initialized when the web application is deployed. The Liberty profile optimizes server start time and memory use by not starting a servlet until a request is received for the web application. You can override this deferral so that your servlets are loaded and initialized when the web application is installed, rather that waiting for the first request for the application.

Example

To configure the server to load servlets when a web application is installed, add the following line to the server.xml configuration file or a file that it includes:
<webContainer deferServletLoad="false"/>
This setting applies to all web applications installed in the server.

Icon that indicates the type of topic Task topic

Terms and conditions for information centers | Feedback


Timestamp icon Last updated: Monday, 21 April 2014
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-base-iseries&topic=twlp_servlet_load
File name: twlp_servlet_load.html