This file is indexed.

/usr/share/tomcat7-docs/docs/class-loader-howto.html is in tomcat7-docs 7.0.56-3+deb8u11.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Apache Tomcat 7 (7.0.56) - Class Loader HOW-TO</title><meta name="author" content="Craig R. McClanahan"><meta name="author" content="Yoav Shapira"><style type="text/css" media="print">
    .noPrint {display: none;}
    td#mainBody {width: 100%;}
</style><style type="text/css">
code {background-color:rgb(224,255,255);padding:0 0.1em;}
code.attributeName, code.propertyName {background-color:transparent;}


table {
  border-collapse: collapse;
  text-align: left;
}
table *:not(table) {
  /* Prevent border-collapsing for table child elements like <div> */
  border-collapse: separate;
}

th {
  text-align: left;
}


div.codeBox pre code, code.attributeName, code.propertyName, code.noHighlight, .noHighlight code {
  background-color: transparent;
}
div.codeBox {
  overflow: auto;
  margin: 1em 0;
}
div.codeBox pre {
  margin: 0;
  padding: 4px;
  border: 1px solid #999;
  border-radius: 5px;
  background-color: #eff8ff;
  display: table; /* To prevent <pre>s from taking the complete available width. */
  /*
  When it is officially supported, use the following CSS instead of display: table
  to prevent big <pre>s from exceeding the browser window:
  max-width: available;
  width: min-content;
  */
}

div.codeBox pre.wrap {
  white-space: pre-wrap;
}


table.defaultTable tr, table.detail-table tr {
    border: 1px solid #CCC;
}

table.defaultTable tr:nth-child(even), table.detail-table tr:nth-child(even) {
    background-color: #FAFBFF;
}

table.defaultTable tr:nth-child(odd), table.detail-table tr:nth-child(odd) {
    background-color: #EEEFFF;
}

table.defaultTable th, table.detail-table th {
  background-color: #88b;
  color: #fff;
}

table.defaultTable th, table.defaultTable td, table.detail-table th, table.detail-table td {
  padding: 5px 8px;
}


p.notice {
    border: 1px solid rgb(255, 0, 0);
    background-color: rgb(238, 238, 238);
    color: rgb(0, 51, 102);
    padding: 0.5em;
    margin: 1em 2em 1em 1em;
}
</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="
      The Apache Tomcat Servlet/JSP Container
    " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 7</font></h1><font face="arial,helvetica,sanserif">Version 7.0.56, Jun 20 2017</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 size="1"></td></tr><tr><!--LEFT SIDE NAVIGATION--><td width="20%" valign="top" nowrap class="noPrint"><p><strong>Links</strong></p><ul><li><a href="index.html">Docs Home</a></li><li><a href="http://wiki.apache.org/tomcat/FAQ">FAQ</a></li><li><a href="#comments_section">User Comments</a></li></ul><p><strong>User Guide</strong></p><ul><li><a href="introduction.html">1) Introduction</a></li><li><a href="setup.html">2) Setup</a></li><li><a href="appdev/index.html">3) First webapp</a></li><li><a href="deployer-howto.html">4) Deployer</a></li><li><a href="manager-howto.html">5) Manager</a></li><li><a href="realm-howto.html">6) Realms and AAA</a></li><li><a href="security-manager-howto.html">7) Security Manager</a></li><li><a href="jndi-resources-howto.html">8) JNDI Resources</a></li><li><a href="jndi-datasource-examples-howto.html">9) JDBC DataSources</a></li><li><a href="class-loader-howto.html">10) Classloading</a></li><li><a href="jasper-howto.html">11) JSPs</a></li><li><a href="ssl-howto.html">12) SSL</a></li><li><a href="ssi-howto.html">13) SSI</a></li><li><a href="cgi-howto.html">14) CGI</a></li><li><a href="proxy-howto.html">15) Proxy Support</a></li><li><a href="mbeans-descriptor-howto.html">16) MBean Descriptor</a></li><li><a href="default-servlet.html">17) Default Servlet</a></li><li><a href="cluster-howto.html">18) Clustering</a></li><li><a href="balancer-howto.html">19) Load Balancer</a></li><li><a href="connectors.html">20) Connectors</a></li><li><a href="monitoring.html">21) Monitoring and Management</a></li><li><a href="logging.html">22) Logging</a></li><li><a href="apr.html">23) APR/Native</a></li><li><a href="virtual-hosting-howto.html">24) Virtual Hosting</a></li><li><a href="aio.html">25) Advanced IO</a></li><li><a href="extras.html">26) Additional Components</a></li><li><a href="maven-jars.html">27) Mavenized</a></li><li><a href="security-howto.html">28) Security Considerations</a></li><li><a href="windows-service-howto.html">29) Windows Service</a></li><li><a href="windows-auth-howto.html">30) Windows Authentication</a></li><li><a href="jdbc-pool.html">31) Tomcat's JDBC Pool</a></li><li><a href="web-socket-howto.html">32) WebSocket</a></li></ul><p><strong>Reference</strong></p><ul><li><a href="RELEASE-NOTES.txt">Release Notes</a></li><li><a href="config/index.html">Configuration</a></li><li><a href="api/index.html">Tomcat Javadocs</a></li><li><a href="servletapi/index.html">Servlet Javadocs</a></li><li><a href="jspapi/index.html">JSP 2.2 Javadocs</a></li><li><a href="elapi/index.html">EL 2.2 Javadocs</a></li><li><a href="websocketapi/index.html">WebSocket 1.0 Javadocs</a></li><li><a href="http://tomcat.apache.org/connectors-doc/">JK 1.2 Documentation</a></li></ul><p><strong>Apache Tomcat Development</strong></p><ul><li><a href="building.html">Building</a></li><li><a href="changelog.html">Changelog</a></li><li><a href="http://wiki.apache.org/tomcat/TomcatVersions">Status</a></li><li><a href="developers.html">Developers</a></li><li><a href="architecture/index.html">Architecture</a></li><li><a href="funcspecs/index.html">Functional Specs.</a></li><li><a href="tribes/introduction.html">Tribes</a></li></ul></td><!--RIGHT SIDE MAIN BODY--><td width="80%" valign="top" align="left" id="mainBody"><h1>Class Loader HOW-TO</h1><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>
<ul><li><a href="#Overview">Overview</a></li><li><a href="#Class_Loader_Definitions">Class Loader Definitions</a></li><li><a href="#XML_Parsers_and_Java">XML Parsers and Java</a></li><li><a href="#Running_under_a_security_manager">Running under a security manager</a></li></ul>
</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Overview"><strong>Overview</strong></a></font></td></tr><tr><td><blockquote>

<p>Like many server applications, Tomcat installs a variety of class loaders
(that is, classes that implement <code>java.lang.ClassLoader</code>) to allow
different portions of the container, and the web applications running on the
container, to have access to different repositories of available classes and
resources.  This mechanism is used to provide the functionality defined in the
Servlet Specification, version 2.4&nbsp;&mdash; in particular, Sections 9.4
and 9.6.</p>

<p>In a Java environment, class loaders are
arranged in a parent-child tree.  Normally, when a class loader is asked to
load a particular class or resource, it delegates the request to a parent
class loader first, and then looks in its own repositories only if the parent
class loader(s) cannot find the requested class or resource.  Note, that the
model for web application class loaders <em>differs</em> slightly from this,
as discussed below, but the main principles are the same.</p>

<p>When Tomcat is started, it creates a set of class loaders that are
organized into the following parent-child relationships, where the parent
class loader is above the child class loader:</p>

<div class="codeBox"><pre><code>      Bootstrap
          |
       System
          |
       Common
       /     \
  Webapp1   Webapp2 ...</code></pre></div>

<p>The characteristics of each of these class loaders, including the source
of classes and resources that they make visible, are discussed in detail in
the following section.</p>

</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Class Loader Definitions"><!--()--></a><a name="Class_Loader_Definitions"><strong>Class Loader Definitions</strong></a></font></td></tr><tr><td><blockquote>

<p>As indicated in the diagram above, Tomcat creates the following class
loaders as it is initialized:</p>
<ul>
<li><p><strong>Bootstrap</strong> &mdash; This class loader contains the basic
    runtime classes provided by the Java Virtual Machine, plus any classes from
    JAR files present in the System Extensions directory
    (<code>$JAVA_HOME/jre/lib/ext</code>).  <em>Note</em>: some JVMs may
    implement this as more than one class loader, or it may not be visible
    (as a class loader) at all.</p></li>
<li><p><strong>System</strong> &mdash; This class loader is normally initialized
    from the contents of the <code>CLASSPATH</code> environment variable.  All
    such classes are visible to both Tomcat internal classes, and to web
    applications.  However, the standard Tomcat startup scripts
    (<code>$CATALINA_HOME/bin/catalina.sh</code> or
    <code>%CATALINA_HOME%\bin\catalina.bat</code>) totally ignore the contents
    of the <code>CLASSPATH</code> environment variable itself, and instead
    build the System class loader from the following repositories:
    </p>
    <ul>
    <li><p><em>$CATALINA_HOME/bin/bootstrap.jar</em> &mdash; Contains the
        main() method that is used to initialize the Tomcat server, and the
        class loader implementation classes it depends on.</p></li>
    <li><p><em>$CATALINA_BASE/bin/tomcat-juli.jar</em> or
        <em>$CATALINA_HOME/bin/tomcat-juli.jar</em> &mdash; Logging
        implementation classes. These include enhancement classes to
        <code>java.util.logging</code> API, known as Tomcat JULI,
        and a package-renamed copy of Apache Commons Logging library
        used internally by Tomcat.
        See <a href="logging.html">logging documentation</a> for more
        details.</p>
        <p>If <code>tomcat-juli.jar</code> is present in
        <em>$CATALINA_BASE/bin</em>, it is used instead of the one in
        <em>$CATALINA_HOME/bin</em>. It is useful in certain logging
        configurations</p></li>
    <li><p><em>$CATALINA_HOME/bin/commons-daemon.jar</em> &mdash; The classes
        from <a href="http://commons.apache.org/daemon/">Apache Commons
        Daemon</a> project.
        This JAR file is not present in the <code>CLASSPATH</code> built by
        <code>catalina.bat</code>|<code>.sh</code> scripts, but is referenced
        from the manifest file of <em>bootstrap.jar</em>.</p></li>
    </ul>
    </li>
<li><p><strong>Common</strong> &mdash; This class loader contains additional
    classes that are made visible to both Tomcat internal classes and to all
    web applications.</p>
    <p>Normally, application classes should <strong>NOT</strong>
    be placed here.  The locations searched by this class loader are defined by
    the <code>common.loader</code> property in
    $CATALINA_BASE/conf/catalina.properties. The default setting will search the
    following locations in the order they are listed:</p>
    <ul>
      <li>unpacked classes and resources in <code>$CATALINA_BASE/lib</code></li>
      <li>JAR files in <code>$CATALINA_BASE/lib</code></li>
      <li>unpacked classes and resources in <code>$CATALINA_HOME/lib</code></li>
      <li>JAR files in <code>$CATALINA_HOME/lib</code></li>
    </ul>
    <p>By default, this includes the following:</p>
    <ul>
    <li><em>annotations-api.jar</em> &mdash; JavaEE annotations classes.</li>
    <li><em>catalina.jar</em> &mdash; Implementation of the Catalina servlet
        container portion of Tomcat.</li>
    <li><em>catalina-ant.jar</em> &mdash; Tomcat Catalina Ant tasks.</li>
    <li><em>catalina-ha.jar</em> &mdash; High availability package.</li>
    <li><em>catalina-tribes.jar</em> &mdash; Group communication package.</li>
    <li><em>ecj-*.jar</em> &mdash; Eclipse JDT Java compiler.</li>
    <li><em>el-api.jar</em> &mdash; EL 2.2 API.</li>
    <li><em>jasper.jar</em> &mdash; Tomcat Jasper JSP Compiler and Runtime.</li>
    <li><em>jasper-el.jar</em> &mdash; Tomcat Jasper EL implementation.</li>
    <li><em>jsp-api.jar</em> &mdash; JSP 2.2 API.</li>
    <li><em>servlet-api.jar</em> &mdash; Servlet 3.0 API.</li>
    <li><em>tomcat-api.jar</em> &mdash; Several interfaces defined by Tomcat.</li>
    <li><em>tomcat-coyote.jar</em> &mdash; Tomcat connectors and utility classes.</li>
    <li><em>tomcat-dbcp.jar</em> &mdash; Database connection pool
        implementation based on package-renamed copy of Apache Commons Pool
        and Apache Commons DBCP.</li>
    <li><em>tomcat-i18n-**.jar</em> &mdash; Optional JARs containing resource bundles
        for other languages. As default bundles are also included in each
        individual JAR, they can be safely removed if no internationalization
        of messages is needed.</li>
    <li><em>tomcat-jdbc.jar</em> &mdash; An alternative database connection pool
        implementation, known as Tomcat JDBC pool. See
        <a href="jdbc-pool.html">documentation</a> for more details.</li>
    <li><em>tomcat-util.jar</em> &mdash; Common classes used by various components of
        Apache Tomcat.</li>
    </ul></li>
<li><p><strong>WebappX</strong> &mdash; A class loader is created for each web
    application that is deployed in a single Tomcat instance.  All unpacked
    classes and resources in the <code>/WEB-INF/classes</code> directory of
    your web application, plus classes and resources in JAR files
    under the <code>/WEB-INF/lib</code> directory of your web application,
    are made visible to this web application, but not to other ones.</p></li>
</ul>

<p>As mentioned above, the web application class loader diverges from the
default Java delegation model (in accordance with the recommendations in the
Servlet Specification, version 2.4, section 9.7.2 Web Application Classloader).
When a request to load a
class from the web application's <em>WebappX</em> class loader is processed,
this class loader will look in the local repositories <strong>first</strong>,
instead of delegating before looking.  There are exceptions. Classes which are
part of the JRE base classes cannot be overridden. For some classes (such as
the XML parser components in J2SE 1.4+), the J2SE 1.4 endorsed feature can be
used.
Last, any JAR file that contains Servlet API classes will be explicitly
ignored by the classloader &mdash; Do not include such JARs in your web
application.
All other class loaders in Tomcat follow the usual delegation pattern.</p>

<p>Therefore, from the perspective of a web application, class or resource
loading looks in the following repositories, in this order:</p>
<ul>
<li>Bootstrap classes of your JVM</li>
<li><em>/WEB-INF/classes</em> of your web application</li>
<li><em>/WEB-INF/lib/*.jar</em> of your web application</li>
<li>System class loader classes (described above)</li>
<li>Common class loader classes (described above)</li>
</ul>

<p>If the web application class loader is configuered with
<code>delegate="true"</code> then the order becomes:</p>
<ul>
<li>Bootstrap classes of your JVM</li>
<li>System class loader classes (described above)</li>
<li>Common class loader classes (described above)</li>
<li><em>/WEB-INF/classes</em> of your web application</li>
<li><em>/WEB-INF/lib/*.jar</em> of your web application</li>
</ul>

</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="XML Parsers and Java"><!--()--></a><a name="XML_Parsers_and_Java"><strong>XML Parsers and Java</strong></a></font></td></tr><tr><td><blockquote>

<p>Starting with Java 1.4 a copy of JAXP APIs and an XML parser are packed
inside the JRE.  This has impacts on applications that wish to use their own
XML parser.</p>

<p>In old versions of Tomcat, you could simply replace the XML parser
in the Tomcat libraries directory to change the parser
used by all web applications.  However, this technique will not be effective
when you are running modern versions of Java, because the usual class loader
delegation process will always choose the implementation inside the JDK in
preference to this one.</p>

<p>Java supports a mechanism called the "Endorsed Standards Override
Mechanism" to allow replacement of APIs created outside of the JCP
(i.e. DOM and SAX from W3C).  It can also be used to update the XML parser
implementation.  For more information, see:
<a href="http://docs.oracle.com/javase/1.5.0/docs/guide/standards/index.html">
http://docs.oracle.com/javase/1.5.0/docs/guide/standards/index.html</a>.</p>

<p>Tomcat utilizes this mechanism by including the system property setting
<code>-Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS</code> in the
command line that starts the container. The default value of this option is
<em>$CATALINA_HOME/endorsed</em>. This <em>endorsed</em> directory is not
created by default.</p>

</blockquote></td></tr></table><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="Running under a security manager"><!--()--></a><a name="Running_under_a_security_manager"><strong>Running under a security manager</strong></a></font></td></tr><tr><td><blockquote>

<p>When running under a security manager the locations from which classes
are permitted to be loaded will also depend on the contents of your policy
file. See <a href="security-manager-howto.html">Security Manager HOW-TO</a>
for further information.</p>

</blockquote></td></tr></table></td></tr><tr class="noPrint"><td width="20%" valign="top" nowrap class="noPrint"></td><td width="80%" valign="top" align="left"><table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#525D76"><font color="#ffffff" face="arial,helvetica.sanserif"><a name="comments_section" id="comments_section"><strong>Comments</strong></a></font></td></tr><tr><td><blockquote><p class="notice"><strong>Notice: </strong>This comments section collects your suggestions
              on improving documentation for Apache Tomcat.<br><br>
              If you have trouble and need help, read
              <a href="http://tomcat.apache.org/findhelp.html">Find Help</a> page
              and ask your question on the tomcat-users
              <a href="http://tomcat.apache.org/lists.html">mailing list</a>.
              Do not ask such questions here. This is not a Q&amp;A section.<br><br>
              The Apache Comments System is explained <a href="./comments.html">here</a>.
              Comments may be removed by our moderators if they are either
              implemented or considered invalid/off-topic.</p><script type="text/javascript"><!--//--><![CDATA[//><!--
              var comments_shortname = 'tomcat';
              var comments_identifier = 'http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html';
              (function(w, d) {
                  if (w.location.hostname.toLowerCase() == "tomcat.apache.org") {
                      d.write('<div id="comments_thread"><\/div>');
                      var s = d.createElement('script');
                      s.type = 'text/javascript';
                      s.async = true;
                      s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
                      (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
                  }
                  else {
                      d.write('<div id="comments_thread"><strong>Comments are disabled for this page at the moment.<\/strong><\/div>');
                  }
              })(window, document);
              //--><!]]></script></blockquote></td></tr></table></td></tr><!--FOOTER SEPARATOR--><tr><td colspan="2"><hr noshade size="1"></td></tr><!--PAGE FOOTER--><tr><td colspan="2"><div align="center"><font color="#525D76" size="-1"><em>
        Copyright &copy; 1999-2017, Apache Software Foundation
        </em></font></div></td></tr></table></body></html>