| 1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat Configuration Reference - The Loader Component</title><meta value="Craig R. McClanahan" name="author"><meta value="craigmcc@apache.org" name="email"></head><body vlink="#525D76" alink="#525D76" link="#525D76" text="#000000" bgcolor="#ffffff"><table cellspacing="0" width="100%" border="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img border="0" alt=" | 
|---|
| 2 | The Apache Tomcat Servlet/JSP Container | 
|---|
| 3 | " align="right" src="../../images/tomcat.gif"></a></td><td><font face="arial,helvetica,sanserif"><h1>Apache Tomcat 6.0</h1></font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img border="0" alt="Apache Logo" align="right" src="../../images/asf-logo.gif"></a></td></tr></table><table cellspacing="4" width="100%" border="0"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><tr><!--RIGHT SIDE MAIN BODY--><td align="left" valign="top" width="80%"><table cellspacing="4" width="100%" border="0"><tr><td valign="top" align="left"><h1>Apache Tomcat Configuration Reference</h1><h2>The Loader Component</h2></td><td nowrap="true" valign="top" align="right"><img border="0" hspace="0" vspace="0" height="1" width="1" src="../../images/void.gif"></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 4 |  | 
|---|
| 5 | <p>The <strong>Loader</strong> element represents the <em>web | 
|---|
| 6 | application class loader</em> that will be used to load Java | 
|---|
| 7 | classes and resources for your web application.  Such | 
|---|
| 8 | a class loader must follow the requirements of the Servlet | 
|---|
| 9 | Specification, and load classes from the following locations:</p> | 
|---|
| 10 | <ul> | 
|---|
| 11 | <li>From the <code>/WEB-INF/classes</code> directory inside your | 
|---|
| 12 | web application.</li> | 
|---|
| 13 | <li>From JAR files in the <code>/WEB-INF/lib</code> directory | 
|---|
| 14 | inside your web application.</li> | 
|---|
| 15 | <li>From resources made available by Catalina to all web | 
|---|
| 16 | applications globally.</li> | 
|---|
| 17 | </ul> | 
|---|
| 18 |  | 
|---|
| 19 | <p>A Loader element MAY be nested inside a <a href="context.html">Context</a> | 
|---|
| 20 | component.  If it is not included, a default Loader configuration will be | 
|---|
| 21 | created automatically, which is sufficient for most requirements.</p> | 
|---|
| 22 |  | 
|---|
| 23 | <p>For a more in-depth description of the class loader hierarchy | 
|---|
| 24 | that is implemented by Catalina, see <a href="../../class-loader-howto.html">the ClassLoader HowTo</a>.</p> | 
|---|
| 25 |  | 
|---|
| 26 | <blockquote><em> | 
|---|
| 27 | <p>The description below uses the variable name $CATALINA_BASE to refer the | 
|---|
| 28 | base directory against which most relative paths are resolved. If you have | 
|---|
| 29 | not configured Tomcat 6 for multiple instances by setting a CATALINA_BASE | 
|---|
| 30 | directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME, | 
|---|
| 31 | the directory into which you have installed Tomcat 6.</p> | 
|---|
| 32 | </em></blockquote> | 
|---|
| 33 |  | 
|---|
| 34 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Attributes"><strong>Attributes</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 35 |  | 
|---|
| 36 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Common Attributes"><strong>Common Attributes</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 37 |  | 
|---|
| 38 | <p>All implementations of <strong>Loader</strong> | 
|---|
| 39 | support the following attributes:</p> | 
|---|
| 40 |  | 
|---|
| 41 | <table cellpadding="5" border="1"><tr><th bgcolor="#023264" width="15%"><font color="#ffffff">Attribute</font></th><th bgcolor="#023264" width="85%"><font color="#ffffff">Description</font></th></tr><tr><td valign="center" align="left"><code>className</code></td><td valign="center" align="left"> | 
|---|
| 42 | <p>Java class name of the implementation to use.  This class must | 
|---|
| 43 | implement the <code>org.apache.catalina.Loader</code> interface. | 
|---|
| 44 | If not specified, the standard value (defined below) will be used.</p> | 
|---|
| 45 | </td></tr><tr><td valign="center" align="left"><code>delegate</code></td><td valign="center" align="left"> | 
|---|
| 46 | <p>Set to <code>true</code> if you want the class loader to follow | 
|---|
| 47 | the standard Java2 delegation model, and attempt to load classes from | 
|---|
| 48 | parent class loaders <strong>before</strong> looking inside the web | 
|---|
| 49 | application.  Set to <code>false</code> (the default) to have the | 
|---|
| 50 | class loader look inside the web application first, before asking | 
|---|
| 51 | parent class loaders to find requested classes or resources.</p> | 
|---|
| 52 | </td></tr><tr><td valign="center" align="left"><code>reloadable</code></td><td valign="center" align="left"> | 
|---|
| 53 | <p>Set to <code>true</code> if you want Catalina to monitor classes in | 
|---|
| 54 | <code>/WEB-INF/classes/</code> and <code>/WEB-INF/lib</code> for | 
|---|
| 55 | changes, and automatically reload the web application if a change | 
|---|
| 56 | is detected.  This feature is very useful during application | 
|---|
| 57 | development, but it requires significant runtime overhead and is | 
|---|
| 58 | not recommended for use on deployed production applications.  You | 
|---|
| 59 | can use the <a href="../../manager-howto.html">Manager</a> web | 
|---|
| 60 | application, however, to trigger reloads of deployed applications | 
|---|
| 61 | on demand.</p> | 
|---|
| 62 |  | 
|---|
| 63 | <p><strong>NOTE</strong> - The value for this property will be | 
|---|
| 64 | inherited from the <code>reloadable</code> attribute you set on | 
|---|
| 65 | the surrounding <a href="context.html">Context</a> component, | 
|---|
| 66 | and any value you explicitly set here will be replaced.</p> | 
|---|
| 67 | </td></tr></table> | 
|---|
| 68 |  | 
|---|
| 69 | </blockquote></td></tr></table> | 
|---|
| 70 |  | 
|---|
| 71 |  | 
|---|
| 72 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Standard Implementation"><strong>Standard Implementation</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 73 |  | 
|---|
| 74 | <p>The standard implementation of <strong>Loader</strong> is | 
|---|
| 75 | <strong>org.apache.catalina.loader.WebappLoader</strong>. | 
|---|
| 76 | It supports the following additional attributes (in addition to the | 
|---|
| 77 | common attributes listed above):</p> | 
|---|
| 78 |  | 
|---|
| 79 | <table cellpadding="5" border="1"><tr><th bgcolor="#023264" width="15%"><font color="#ffffff">Attribute</font></th><th bgcolor="#023264" width="85%"><font color="#ffffff">Description</font></th></tr><tr><td valign="center" align="left"><code>loaderClass</code></td><td valign="center" align="left"> | 
|---|
| 80 | <p>Java class name of the <code>java.lang.ClassLoader</code> | 
|---|
| 81 | implementation class to use.  If not specified, the default value is | 
|---|
| 82 | <code>org.apache.catalina.loader.WebappClassLoader</code>.</p> | 
|---|
| 83 | </td></tr></table> | 
|---|
| 84 |  | 
|---|
| 85 | </blockquote></td></tr></table> | 
|---|
| 86 |  | 
|---|
| 87 |  | 
|---|
| 88 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Nested Components"><strong>Nested Components</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 89 |  | 
|---|
| 90 | <p>No components may be nested inside a <strong>Loader</strong> element.</p> | 
|---|
| 91 |  | 
|---|
| 92 | </blockquote></td></tr></table><table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#525D76"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Special Features"><strong>Special Features</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 93 |  | 
|---|
| 94 | <table cellpadding="2" cellspacing="0" border="0"><tr><td bgcolor="#828DA6"><font face="arial,helvetica.sanserif" color="#ffffff"><a name="Logging"><strong>Logging</strong></a></font></td></tr><tr><td><blockquote> | 
|---|
| 95 |  | 
|---|
| 96 | <p>A loader is associated with the log category based on its classname.</p> | 
|---|
| 97 |  | 
|---|
| 98 | </blockquote></td></tr></table> | 
|---|
| 99 |  | 
|---|
| 100 | </blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr size="1" noshade></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font size="-1" color="#525D76"><em> | 
|---|
| 101 | Copyright © 1999-2008, Apache Software Foundation | 
|---|
| 102 | </em></font></div></td></tr></table></body></html> | 
|---|