+

Search Tips   |   Advanced Search

Specify when servlets are loaded and initialized

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

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. We can override this deferral so the 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 server.xml.or a file that it includes:

This setting applies to all web applications installed in the server.


Parent topic: Administer web applications