blob: 25ec15cba1a0e067ef9e0e63951c86e7f7ecde7b [file] [log] [blame]
Hongqing Liufd5ee812014-05-10 16:32:51 +08001<html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat Configuration Reference (6.0.39) - The Loader Component</title><meta name="author" content="Craig R. McClanahan"><style type="text/css" media="print">
2 .noPrint {display: none;}
3 td#mainBody {width: 100%;}
4 </style></head><body bgcolor="#ffffff" text="#000000" link="#525D76" alink="#525D76" vlink="#525D76"><table border="0" width="100%" cellspacing="0"><!--PAGE HEADER--><tr><td><!--PROJECT LOGO--><a href="http://tomcat.apache.org/"><img src="../images/tomcat.gif" align="right" alt="
5 The Apache Tomcat Servlet/JSP Container
6 " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 6.0</font></h1><font face="arial,helvetica,sanserif">Version 6.0.39, Jan 27 2014</font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img src="../images/asf-logo.gif" align="right" alt="Apache Logo" border="0"></a></td></tr></table><table border="0" width="100%" cellspacing="4"><!--HEADER SEPARATOR--><tr><td colspan="2"><hr noshade="noshade" size="1"></td></tr><tr><!--LEFT SIDE NAVIGATION--><td width="20%" valign="top" nowrap="nowrap" class="noPrint"><p><strong>Links</strong></p><ul><li><a href="../index.html">Docs Home</a></li><li><a href="index.html">Config Ref. Home</a></li></ul><p><strong>Top Level Elements</strong></p><ul><li><a href="server.html">Server</a></li><li><a href="service.html">Service</a></li></ul><p><strong>Executors</strong></p><ul><li><a href="executor.html">Executor</a></li></ul><p><strong>Connectors</strong></p><ul><li><a href="http.html">HTTP</a></li><li><a href="ajp.html">AJP</a></li></ul><p><strong>Containers</strong></p><ul><li><a href="context.html">Context</a></li><li><a href="engine.html">Engine</a></li><li><a href="host.html">Host</a></li><li><a href="cluster.html">Cluster</a></li></ul><p><strong>Nested Components</strong></p><ul><li><a href="globalresources.html">Global Resources</a></li><li><a href="listeners.html">Listeners</a></li><li><a href="loader.html">Loader</a></li><li><a href="manager.html">Manager</a></li><li><a href="realm.html">Realm</a></li><li><a href="resources.html">Resources</a></li><li><a href="valve.html">Valve</a></li></ul><p><strong>Cluster Elements</strong></p><ul><li><a href="cluster.html">Cluster</a></li><li><a href="cluster-manager.html">Manager</a></li><li><a href="cluster-channel.html">Channel</a></li><li><a href="cluster-membership.html">Channel/Membership</a></li><li><a href="cluster-sender.html">Channel/Sender</a></li><li><a href="cluster-receiver.html">Channel/Receiver</a></li><li><a href="cluster-interceptor.html">Channel/Interceptor</a></li><li><a href="cluster-valve.html">Valve</a></li><li><a href="cluster-deployer.html">Deployer</a></li><li><a href="cluster-listener.html">ClusterListener</a></li></ul><p><strong>Other</strong></p><ul><li><a href="filter.html">Filter</a></li><li><a href="systemprops.html">System properties</a></li></ul></td><!--RIGHT SIDE MAIN BODY--><td width="80%" valign="top" align="left" id="mainBody"><h1>Apache Tomcat Configuration Reference</h1><h2>The Loader Component</h2><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Table of Contents"><!--()--></a><a name="Table_of_Contents"><strong>Table of Contents</strong></a></font></td></tr><tr><td><blockquote>
7<ul><li><a href="#Introduction">Introduction</a></li><li><a href="#Attributes">Attributes</a><ol><li><a href="#Common_Attributes">Common Attributes</a></li><li><a href="#Standard_Implementation">Standard Implementation</a></li></ol></li><li><a href="#Nested_Components">Nested Components</a></li><li><a href="#Special_Features">Special Features</a><ol><li><a href="#Logging">Logging</a></li></ol></li></ul>
8</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Introduction"><strong>Introduction</strong></a></font></td></tr><tr><td><blockquote>
9
10 <p>The <strong>Loader</strong> element represents the <em>web
11 application class loader</em> that will be used to load Java
12 classes and resources for your web application. Such
13 a class loader must follow the requirements of the Servlet
14 Specification, and load classes from the following locations:</p>
15 <ul>
16 <li>From the <code>/WEB-INF/classes</code> directory inside your
17 web application.</li>
18 <li>From JAR files in the <code>/WEB-INF/lib</code> directory
19 inside your web application.</li>
20 <li>From resources made available by Catalina to all web
21 applications globally.</li>
22 </ul>
23
24 <p>A Loader element MAY be nested inside a <a href="context.html">Context</a>
25 component. If it is not included, a default Loader configuration will be
26 created automatically, which is sufficient for most requirements.</p>
27
28 <p>For a more in-depth description of the class loader hierarchy
29 that is implemented by Catalina, see <a href="../class-loader-howto.html">the ClassLoader HowTo</a>.</p>
30
31 <blockquote><em>
32 <p>The description below uses the variable name $CATALINA_BASE to refer the
33 base directory against which most relative paths are resolved. If you have
34 not configured Tomcat 6 for multiple instances by setting a CATALINA_BASE
35 directory, then $CATALINA_BASE will be set to the value of $CATALINA_HOME,
36 the directory into which you have installed Tomcat 6.</p>
37 </em></blockquote>
38
39</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Attributes"><strong>Attributes</strong></a></font></td></tr><tr><td><blockquote>
40
41 <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Common Attributes"><!--()--></a><a name="Common_Attributes"><strong>Common Attributes</strong></a></font></td></tr><tr><td><blockquote>
42
43 <p>All implementations of <strong>Loader</strong>
44 support the following attributes:</p>
45
46 <table border="1" cellpadding="5"><tr><th width="15%" bgcolor="#023264"><font color="#ffffff">Attribute</font></th><th width="85%" bgcolor="#023264"><font color="#ffffff">Description</font></th></tr><tr><td align="left" valign="center"><code>className</code></td><td align="left" valign="center">
47 <p>Java class name of the implementation to use. This class must
48 implement the <code>org.apache.catalina.Loader</code> interface.
49 If not specified, the standard value (defined below) will be used.</p>
50 </td></tr><tr><td align="left" valign="center"><code>delegate</code></td><td align="left" valign="center">
51 <p>Set to <code>true</code> if you want the class loader to follow
52 the standard Java2 delegation model, and attempt to load classes from
53 parent class loaders <strong>before</strong> looking inside the web
54 application. Set to <code>false</code> (the default) to have the
55 class loader look inside the web application first, before asking
56 parent class loaders to find requested classes or resources.</p>
57 </td></tr><tr><td align="left" valign="center"><code>reloadable</code></td><td align="left" valign="center">
58 <p>Set to <code>true</code> if you want Catalina to monitor classes in
59 <code>/WEB-INF/classes/</code> and <code>/WEB-INF/lib</code> for
60 changes, and automatically reload the web application if a change
61 is detected. This feature is very useful during application
62 development, but it requires significant runtime overhead and is
63 not recommended for use on deployed production applications. You
64 can use the <a href="../manager-howto.html">Manager</a> web
65 application, however, to trigger reloads of deployed applications
66 on demand.</p>
67
68 <p><strong>NOTE</strong> - The value for this property will be
69 inherited from the <code>reloadable</code> attribute you set on
70 the surrounding <a href="context.html">Context</a> component,
71 and any value you explicitly set here will be replaced.</p>
72 </td></tr></table>
73
74 </blockquote></td></tr></table>
75
76
77 <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Standard Implementation"><!--()--></a><a name="Standard_Implementation"><strong>Standard Implementation</strong></a></font></td></tr><tr><td><blockquote>
78
79 <p>The standard implementation of <strong>Loader</strong> is
80 <strong>org.apache.catalina.loader.WebappLoader</strong>.
81 It supports the following additional attributes (in addition to the
82 common attributes listed above):</p>
83
84 <table border="1" cellpadding="5"><tr><th width="15%" bgcolor="#023264"><font color="#ffffff">Attribute</font></th><th width="85%" bgcolor="#023264"><font color="#ffffff">Description</font></th></tr><tr><td align="left" valign="center"><code>loaderClass</code></td><td align="left" valign="center">
85 <p>Java class name of the <code>java.lang.ClassLoader</code>
86 implementation class to use. If not specified, the default value is
87 <code>org.apache.catalina.loader.WebappClassLoader</code>. Custom
88 <strong>loaderClass</strong> implementations must extend
89 <code>org.apache.catalina.loader.WebappClassLoader</code>.</p>
90 </td></tr><tr><td align="left" valign="center"><code>searchExternalFirst</code></td><td align="left" valign="center">
91 <p>Set to <code>true</code> if you want repositories outside
92 of <code>WEB-INF/classes</code> and <code>WEB-INF/lib</code> to
93 be searched first. Default value is <code>false</code>.</p>
94 </td></tr></table>
95
96 </blockquote></td></tr></table>
97
98
99</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Nested Components"><!--()--></a><a name="Nested_Components"><strong>Nested Components</strong></a></font></td></tr><tr><td><blockquote>
100
101 <p>No components may be nested inside a <strong>Loader</strong> element.</p>
102
103</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Special Features"><!--()--></a><a name="Special_Features"><strong>Special Features</strong></a></font></td></tr><tr><td><blockquote>
104
105 <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#828DA6"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Logging"><strong>Logging</strong></a></font></td></tr><tr><td><blockquote>
106
107 <p>A loader is associated with the log category based on its classname.</p>
108
109 </blockquote></td></tr></table>
110
111</blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr noshade="noshade" size="1"></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font color="#525D76" size="-1"><em>
112 Copyright &copy; 1999-2014, Apache Software Foundation
113 </em></font></div></td></tr></table></body></html>