刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 1 | <html><head><META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Apache Tomcat 7 (7.0.77) - Class Loader HOW-TO</title><meta name="author" content="Craig R. McClanahan"><meta name="author" content="Yoav Shapira"><style type="text/css" media="print">
|
| 2 | .noPrint {display: none;}
|
| 3 | td#mainBody {width: 100%;}
|
| 4 | </style><style type="text/css">
|
| 5 | code {background-color:rgb(224,255,255);padding:0 0.1em;}
|
| 6 | code.attributeName, code.propertyName {background-color:transparent;}
|
| 7 |
|
| 8 |
|
| 9 | table {
|
| 10 | border-collapse: collapse;
|
| 11 | text-align: left;
|
| 12 | }
|
| 13 | table *:not(table) {
|
| 14 | /* Prevent border-collapsing for table child elements like <div> */
|
| 15 | border-collapse: separate;
|
| 16 | }
|
| 17 |
|
| 18 | th {
|
| 19 | text-align: left;
|
| 20 | }
|
| 21 |
|
| 22 |
|
| 23 | div.codeBox pre code, code.attributeName, code.propertyName, code.noHighlight, .noHighlight code {
|
| 24 | background-color: transparent;
|
| 25 | }
|
| 26 | div.codeBox {
|
| 27 | overflow: auto;
|
| 28 | margin: 1em 0;
|
| 29 | }
|
| 30 | div.codeBox pre {
|
| 31 | margin: 0;
|
| 32 | padding: 4px;
|
| 33 | border: 1px solid #999;
|
| 34 | border-radius: 5px;
|
| 35 | background-color: #eff8ff;
|
| 36 | display: table; /* To prevent <pre>s from taking the complete available width. */
|
| 37 | /*
|
| 38 | When it is officially supported, use the following CSS instead of display: table
|
| 39 | to prevent big <pre>s from exceeding the browser window:
|
| 40 | max-width: available;
|
| 41 | width: min-content;
|
| 42 | */
|
| 43 | }
|
| 44 |
|
| 45 | div.codeBox pre.wrap {
|
| 46 | white-space: pre-wrap;
|
| 47 | }
|
| 48 |
|
| 49 |
|
| 50 | table.defaultTable tr, table.detail-table tr {
|
| 51 | border: 1px solid #CCC;
|
| 52 | }
|
| 53 |
|
| 54 | table.defaultTable tr:nth-child(even), table.detail-table tr:nth-child(even) {
|
| 55 | background-color: #FAFBFF;
|
| 56 | }
|
| 57 |
|
| 58 | table.defaultTable tr:nth-child(odd), table.detail-table tr:nth-child(odd) {
|
| 59 | background-color: #EEEFFF;
|
| 60 | }
|
| 61 |
|
| 62 | table.defaultTable th, table.detail-table th {
|
| 63 | background-color: #88b;
|
| 64 | color: #fff;
|
| 65 | }
|
| 66 |
|
| 67 | table.defaultTable th, table.defaultTable td, table.detail-table th, table.detail-table td {
|
| 68 | padding: 5px 8px;
|
| 69 | }
|
| 70 |
|
| 71 |
|
| 72 | p.notice {
|
| 73 | border: 1px solid rgb(255, 0, 0);
|
| 74 | background-color: rgb(238, 238, 238);
|
| 75 | color: rgb(0, 51, 102);
|
| 76 | padding: 0.5em;
|
| 77 | margin: 1em 2em 1em 1em;
|
| 78 | }
|
| 79 | </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="
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 80 | The Apache Tomcat Servlet/JSP Container
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 81 | " border="0"></a></td><td><h1><font face="arial,helvetica,sanserif">Apache Tomcat 7</font></h1><font face="arial,helvetica,sanserif">Version 7.0.77, Mar 28 2017</font></td><td><!--APACHE LOGO--><a href="http://www.apache.org/"><img src="./images/asf-logo.svg" align="right" alt="Apache Logo" border="0" style="width: 266px;height: 83px;"></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/TLS</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-descriptors-howto.html">16) MBeans Descriptors</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.1 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>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 82 | <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>
|
| 83 | </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>
|
| 84 |
|
| 85 | <p>Like many server applications, Tomcat installs a variety of class loaders
|
| 86 | (that is, classes that implement <code>java.lang.ClassLoader</code>) to allow
|
| 87 | different portions of the container, and the web applications running on the
|
| 88 | container, to have access to different repositories of available classes and
|
| 89 | resources. This mechanism is used to provide the functionality defined in the
|
| 90 | Servlet Specification, version 2.4 — in particular, Sections 9.4
|
| 91 | and 9.6.</p>
|
| 92 |
|
| 93 | <p>In a Java environment, class loaders are
|
| 94 | arranged in a parent-child tree. Normally, when a class loader is asked to
|
| 95 | load a particular class or resource, it delegates the request to a parent
|
| 96 | class loader first, and then looks in its own repositories only if the parent
|
| 97 | class loader(s) cannot find the requested class or resource. Note, that the
|
| 98 | model for web application class loaders <em>differs</em> slightly from this,
|
| 99 | as discussed below, but the main principles are the same.</p>
|
| 100 |
|
| 101 | <p>When Tomcat is started, it creates a set of class loaders that are
|
| 102 | organized into the following parent-child relationships, where the parent
|
| 103 | class loader is above the child class loader:</p>
|
| 104 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 105 | <div class="codeBox"><pre><code> Bootstrap
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 106 | |
|
| 107 | System
|
| 108 | |
|
| 109 | Common
|
| 110 | / \
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 111 | Webapp1 Webapp2 ...</code></pre></div>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 112 |
|
| 113 | <p>The characteristics of each of these class loaders, including the source
|
| 114 | of classes and resources that they make visible, are discussed in detail in
|
| 115 | the following section.</p>
|
| 116 |
|
| 117 | </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>
|
| 118 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 119 | <p>As indicated in the diagram above, Tomcat creates the following class
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 120 | loaders as it is initialized:</p>
|
| 121 | <ul>
|
| 122 | <li><p><strong>Bootstrap</strong> — This class loader contains the basic
|
| 123 | runtime classes provided by the Java Virtual Machine, plus any classes from
|
| 124 | JAR files present in the System Extensions directory
|
| 125 | (<code>$JAVA_HOME/jre/lib/ext</code>). <em>Note</em>: some JVMs may
|
| 126 | implement this as more than one class loader, or it may not be visible
|
| 127 | (as a class loader) at all.</p></li>
|
| 128 | <li><p><strong>System</strong> — This class loader is normally initialized
|
| 129 | from the contents of the <code>CLASSPATH</code> environment variable. All
|
| 130 | such classes are visible to both Tomcat internal classes, and to web
|
| 131 | applications. However, the standard Tomcat startup scripts
|
| 132 | (<code>$CATALINA_HOME/bin/catalina.sh</code> or
|
| 133 | <code>%CATALINA_HOME%\bin\catalina.bat</code>) totally ignore the contents
|
| 134 | of the <code>CLASSPATH</code> environment variable itself, and instead
|
| 135 | build the System class loader from the following repositories:
|
| 136 | </p>
|
| 137 | <ul>
|
| 138 | <li><p><em>$CATALINA_HOME/bin/bootstrap.jar</em> — Contains the
|
| 139 | main() method that is used to initialize the Tomcat server, and the
|
| 140 | class loader implementation classes it depends on.</p></li>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 141 | <li><p><em>$CATALINA_BASE/bin/tomcat-juli.jar</em> or
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 142 | <em>$CATALINA_HOME/bin/tomcat-juli.jar</em> — Logging
|
| 143 | implementation classes. These include enhancement classes to
|
| 144 | <code>java.util.logging</code> API, known as Tomcat JULI,
|
| 145 | and a package-renamed copy of Apache Commons Logging library
|
| 146 | used internally by Tomcat.
|
| 147 | See <a href="logging.html">logging documentation</a> for more
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 148 | details.</p>
|
| 149 | <p>If <code>tomcat-juli.jar</code> is present in
|
| 150 | <em>$CATALINA_BASE/bin</em>, it is used instead of the one in
|
| 151 | <em>$CATALINA_HOME/bin</em>. It is useful in certain logging
|
| 152 | configurations</p></li>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 153 | <li><p><em>$CATALINA_HOME/bin/commons-daemon.jar</em> — The classes
|
| 154 | from <a href="http://commons.apache.org/daemon/">Apache Commons
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 155 | Daemon</a> project.
|
| 156 | This JAR file is not present in the <code>CLASSPATH</code> built by
|
| 157 | <code>catalina.bat</code>|<code>.sh</code> scripts, but is referenced
|
| 158 | from the manifest file of <em>bootstrap.jar</em>.</p></li>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 159 | </ul>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 160 | </li>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 161 | <li><p><strong>Common</strong> — This class loader contains additional
|
| 162 | classes that are made visible to both Tomcat internal classes and to all
|
| 163 | web applications.</p>
|
| 164 | <p>Normally, application classes should <strong>NOT</strong>
|
| 165 | be placed here. The locations searched by this class loader are defined by
|
| 166 | the <code>common.loader</code> property in
|
| 167 | $CATALINA_BASE/conf/catalina.properties. The default setting will search the
|
| 168 | following locations in the order they are listed:</p>
|
| 169 | <ul>
|
| 170 | <li>unpacked classes and resources in <code>$CATALINA_BASE/lib</code></li>
|
| 171 | <li>JAR files in <code>$CATALINA_BASE/lib</code></li>
|
| 172 | <li>unpacked classes and resources in <code>$CATALINA_HOME/lib</code></li>
|
| 173 | <li>JAR files in <code>$CATALINA_HOME/lib</code></li>
|
| 174 | </ul>
|
| 175 | <p>By default, this includes the following:</p>
|
| 176 | <ul>
|
| 177 | <li><em>annotations-api.jar</em> — JavaEE annotations classes.</li>
|
| 178 | <li><em>catalina.jar</em> — Implementation of the Catalina servlet
|
| 179 | container portion of Tomcat.</li>
|
| 180 | <li><em>catalina-ant.jar</em> — Tomcat Catalina Ant tasks.</li>
|
| 181 | <li><em>catalina-ha.jar</em> — High availability package.</li>
|
| 182 | <li><em>catalina-tribes.jar</em> — Group communication package.</li>
|
| 183 | <li><em>ecj-*.jar</em> — Eclipse JDT Java compiler.</li>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 184 | <li><em>el-api.jar</em> — EL 2.2 API.</li>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 185 | <li><em>jasper.jar</em> — Tomcat Jasper JSP Compiler and Runtime.</li>
|
| 186 | <li><em>jasper-el.jar</em> — Tomcat Jasper EL implementation.</li>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 187 | <li><em>jsp-api.jar</em> — JSP 2.2 API.</li>
|
| 188 | <li><em>servlet-api.jar</em> — Servlet 3.0 API.</li>
|
| 189 | <li><em>tomcat-api.jar</em> — Several interfaces defined by Tomcat.</li>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 190 | <li><em>tomcat-coyote.jar</em> — Tomcat connectors and utility classes.</li>
|
| 191 | <li><em>tomcat-dbcp.jar</em> — Database connection pool
|
| 192 | implementation based on package-renamed copy of Apache Commons Pool
|
| 193 | and Apache Commons DBCP.</li>
|
| 194 | <li><em>tomcat-i18n-**.jar</em> — Optional JARs containing resource bundles
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 195 | for other languages. As default bundles are also included in each
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 196 | individual JAR, they can be safely removed if no internationalization
|
| 197 | of messages is needed.</li>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 198 | <li><em>tomcat-jdbc.jar</em> — An alternative database connection pool
|
| 199 | implementation, known as Tomcat JDBC pool. See
|
| 200 | <a href="jdbc-pool.html">documentation</a> for more details.</li>
|
| 201 | <li><em>tomcat-util.jar</em> — Common classes used by various components of
|
| 202 | Apache Tomcat.</li>
|
| 203 | <li><em>tomcat7-websocket.jar</em> — WebSocket 1.1 implementation</li>
|
| 204 | <li><em>websocket-api.jar</em> — WebSocket 1.1 API</li>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 205 | </ul></li>
|
| 206 | <li><p><strong>WebappX</strong> — A class loader is created for each web
|
| 207 | application that is deployed in a single Tomcat instance. All unpacked
|
| 208 | classes and resources in the <code>/WEB-INF/classes</code> directory of
|
| 209 | your web application, plus classes and resources in JAR files
|
| 210 | under the <code>/WEB-INF/lib</code> directory of your web application,
|
| 211 | are made visible to this web application, but not to other ones.</p></li>
|
| 212 | </ul>
|
| 213 |
|
| 214 | <p>As mentioned above, the web application class loader diverges from the
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 215 | default Java delegation model (in accordance with the recommendations in the
|
| 216 | Servlet Specification, version 2.4, section 9.7.2 Web Application Classloader).
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 217 | When a request to load a
|
| 218 | class from the web application's <em>WebappX</em> class loader is processed,
|
| 219 | this class loader will look in the local repositories <strong>first</strong>,
|
| 220 | instead of delegating before looking. There are exceptions. Classes which are
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 221 | part of the JRE base classes cannot be overridden. For some classes (such as
|
| 222 | the XML parser components in J2SE 1.4+), the J2SE 1.4 endorsed feature can be
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 223 | used.
|
| 224 | Last, any JAR file that contains Servlet API classes will be explicitly
|
| 225 | ignored by the classloader — Do not include such JARs in your web
|
| 226 | application.
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 227 | All other class loaders in Tomcat follow the usual delegation pattern.</p>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 228 |
|
| 229 | <p>Therefore, from the perspective of a web application, class or resource
|
| 230 | loading looks in the following repositories, in this order:</p>
|
| 231 | <ul>
|
| 232 | <li>Bootstrap classes of your JVM</li>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 233 | <li><em>/WEB-INF/classes</em> of your web application</li>
|
| 234 | <li><em>/WEB-INF/lib/*.jar</em> of your web application</li>
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 235 | <li>System class loader classes (described above)</li>
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 236 | <li>Common class loader classes (described above)</li>
|
| 237 | </ul>
|
| 238 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 239 | <p>If the web application class loader is
|
| 240 | <a href="config/loader.html">configured</a> with
|
| 241 | <code><Loader delegate="true"/></code>
|
| 242 | then the order becomes:</p>
|
| 243 | <ul>
|
| 244 | <li>Bootstrap classes of your JVM</li>
|
| 245 | <li>System class loader classes (described above)</li>
|
| 246 | <li>Common class loader classes (described above)</li>
|
| 247 | <li><em>/WEB-INF/classes</em> of your web application</li>
|
| 248 | <li><em>/WEB-INF/lib/*.jar</em> of your web application</li>
|
| 249 | </ul>
|
| 250 |
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 251 | </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>
|
| 252 |
|
| 253 | <p>Starting with Java 1.4 a copy of JAXP APIs and an XML parser are packed
|
| 254 | inside the JRE. This has impacts on applications that wish to use their own
|
| 255 | XML parser.</p>
|
| 256 |
|
| 257 | <p>In old versions of Tomcat, you could simply replace the XML parser
|
| 258 | in the Tomcat libraries directory to change the parser
|
| 259 | used by all web applications. However, this technique will not be effective
|
| 260 | when you are running modern versions of Java, because the usual class loader
|
| 261 | delegation process will always choose the implementation inside the JDK in
|
| 262 | preference to this one.</p>
|
| 263 |
|
| 264 | <p>Java supports a mechanism called the "Endorsed Standards Override
|
| 265 | Mechanism" to allow replacement of APIs created outside of the JCP
|
| 266 | (i.e. DOM and SAX from W3C). It can also be used to update the XML parser
|
| 267 | implementation. For more information, see:
|
| 268 | <a href="http://docs.oracle.com/javase/1.5.0/docs/guide/standards/index.html">
|
| 269 | http://docs.oracle.com/javase/1.5.0/docs/guide/standards/index.html</a>.</p>
|
| 270 |
|
| 271 | <p>Tomcat utilizes this mechanism by including the system property setting
|
| 272 | <code>-Djava.endorsed.dirs=$JAVA_ENDORSED_DIRS</code> in the
|
| 273 | command line that starts the container. The default value of this option is
|
| 274 | <em>$CATALINA_HOME/endorsed</em>. This <em>endorsed</em> directory is not
|
| 275 | created by default.</p>
|
| 276 |
|
| 277 | </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>
|
| 278 |
|
| 279 | <p>When running under a security manager the locations from which classes
|
| 280 | are permitted to be loaded will also depend on the contents of your policy
|
| 281 | file. See <a href="security-manager-howto.html">Security Manager HOW-TO</a>
|
| 282 | for further information.</p>
|
| 283 |
|
刘洪青 | 6266f99 | 2017-05-15 21:21:03 +0800 | [diff] [blame^] | 284 | </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
|
| 285 | on improving documentation for Apache Tomcat.<br><br>
|
| 286 | If you have trouble and need help, read
|
| 287 | <a href="http://tomcat.apache.org/findhelp.html">Find Help</a> page
|
| 288 | and ask your question on the tomcat-users
|
| 289 | <a href="http://tomcat.apache.org/lists.html">mailing list</a>.
|
| 290 | Do not ask such questions here. This is not a Q&A section.<br><br>
|
| 291 | The Apache Comments System is explained <a href="./comments.html">here</a>.
|
| 292 | Comments may be removed by our moderators if they are either
|
| 293 | implemented or considered invalid/off-topic.</p><script type="text/javascript"><!--//--><![CDATA[//><!--
|
| 294 | var comments_shortname = 'tomcat';
|
| 295 | var comments_identifier = 'http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html';
|
| 296 | (function(w, d) {
|
| 297 | if (w.location.hostname.toLowerCase() == "tomcat.apache.org") {
|
| 298 | d.write('<div id="comments_thread"><\/div>');
|
| 299 | var s = d.createElement('script');
|
| 300 | s.type = 'text/javascript';
|
| 301 | s.async = true;
|
| 302 | s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
|
| 303 | (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
|
| 304 | }
|
| 305 | else {
|
| 306 | d.write('<div id="comments_thread"><strong>Comments are disabled for this page at the moment.<\/strong><\/div>');
|
| 307 | }
|
| 308 | })(window, document);
|
| 309 | //--><!]]></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>
|
| 310 | Copyright © 1999-2017, Apache Software Foundation
|
Hongqing Liu | fd5ee81 | 2014-05-10 16:32:51 +0800 | [diff] [blame] | 311 | </em></font></div></td></tr></table></body></html> |