The Loader Component
Table of Contents
Introduction
The Loader element represents the web application class loader that will be used to load Java classes and resources for your web application. Such a class loader must follow the requirements of the Servlet Specification, and load classes from the following locations:
- From the
/WEB-INF/classes
directory inside your web application. - From JAR files in the
/WEB-INF/lib
directory inside your web application. - From resources made available by Catalina to all web applications globally.
A Loader element MAY be nested inside a Context component. If it is not included, a default Loader configuration will be created automatically, which is sufficient for most requirements.
For a more in-depth description of the class loader hierarchy that is implemented by Catalina, see the ClassLoader HowTo.
The description below uses the variable name $CATALINA_BASE to refer the base directory against which most relative paths are resolved. If you have not configured Tomcat for multiple instances by setting a CATALINA_BASE directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME, the directory into which you have installed Tomcat.
Attributes
Common Attributes
All implementations of Loader support the following attributes:
Attribute | Description |
---|---|
className |
Java class name of the implementation to use. This class must
implement the |
delegate |
Set to |
Standard Implementation
The standard implementation of Loader is org.apache.catalina.loader.WebappLoader. It supports the following additional attributes (in addition to the common attributes listed above):
Attribute | Description |
---|---|
loaderClass |
Java class name of the If not specified, the default value is
|
Nested Components
No components may be nested inside a Loader element.
Special Features
Logging
A loader is associated with the log category based on its classname.