<body>
-<section name="Quick Start">
-
-<p>The following rules cover about 95% of the decisions that application
-developers and deployers must make about where to place class and resource
-files to make them available to web applications:</p>
-<ul>
-<li>For classes and resources specific to a particular web application,
- place unpacked classes and resources under <code>/WEB-INF/classes</code>
- of your web application archive, or place JAR files containing those
- classes and resources under <code>/WEB-INF/lib</code> of your web
- application archive.</li>
-<li>For classes and resources that must be shared across all web applications,
- place unpacked classes and resources under
- <code>$CATALINA_BASE/shared/classes</code>, or place JAR files
- containing those classes and resources under
- <code>$CATALINA_BASE/shared/lib</code>.</li>
-</ul>
-
-</section>
-
-
<section name="Overview">
-<p>Like many server applications, Tomcat 5 installs a variety of class loaders
+<p>Like many server applications, Tomcat 6 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
web application class loaders differs slightly from this, as discussed below,
but the main principles are the same.</p>
-<p>When Tomcat 5 is started, it creates a set of class loaders that are
+<p>When Tomcat 6 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>
System
|
Common
- / \
- Catalina Shared
- / \
- Webapp1 Webapp2 ...
+ / \
+ Webapp1 Webapp2 ...
</source>
<p>The characteristics of each of these class loaders, including the source
<section name="Class Loader Definitions">
-<p>As indicated in the diagram above, Tomcat 5 creates the following class
+<p>As indicated in the diagram above, Tomcat 6 creates the following class
loaders as it is initialized:</p>
<ul>
<li><strong>Bootstrap</strong> - This class loader contains the basic runtime
build the System class loader from the following repositories:
<ul>
<li><em>$CATALINA_HOME/bin/bootstrap.jar</em> - Contains the main() method
- that is used to initialize the Tomcat 5 server, and the class loader
+ that is used to initialize the Tomcat 6 server, and the class loader
implementation classes it depends on.</li>
- <li><em>$JAVA_HOME/lib/tools.jar</em> - Contains the "javac" compiler used
- to convert JSP pages into servlet classes.</li>
<li><em>$CATALINA_HOME/bin/commons-logging-api.jar</em> - Jakarta commons
logging API.</li>
- <li><em>$CATALINA_HOME/bin/commons-daemon.jar</em> - Jakarta commons
- daemon API.</li>
- <li><em>jmx.jar</em> - The JMX 1.2 implementation.</li>
</ul></li>
<li><strong>Common</strong> - This class loader contains additional classes
that are made visible to both Tomcat internal classes and to all web
applications. Normally, application classes should <strong>NOT</strong>
be placed here. All unpacked classes and resources in
- <code>$CATALINA_HOME/common/classes</code>, as well as classes and
- resources in JAR files under the
- <code>$CATALINA_HOME/commons/endorsed</code>,
- <code>$CATALINA_HOME/commons/i18n</code> and
- <code>$CATALINA_HOME/common/lib</code> directories,
- are made visible through this
+ <code>$CATALINA_HOME/lib</code>, as well as classes and
+ resources in JAR files are made visible through this
class loader. By default, that includes the following:
<ul>
- <li><em>commons-el.jar</em> - Jakarta commons el, implementing the
- expression language used by Jasper.</li>
- <li><em>jasper-compiler.jar</em> - The JSP 2.0 compiler.</li>
- <li><em>jasper-compiler-jdt.jar</em> - The Eclipse JDT Java compiler.</li>
- <li><em>jasper-runtime.jar</em> - The JSP 2.0 runtime.</li>
- <li><em>jsp-api.jar</em> - The JSP 2.0 API.</li>
- <li><em>naming-common.jar</em> - The JNDI implementation used by Tomcat 5
- to represent in-memory naming contexts.</li>
- <li><em>naming-factory.jar</em> - The JNDI implementation used by Tomcat 5
- to resolve references to enterprise resources (EJB, connection
- pools).</li>
- <li><em>naming-factory-dbcp.jar</em> - Jakarta commons DBCP, providing a
- JDBC connection pool to web applications. The classes have been moved
- out of their default org.apache.commons package.</li>
- <li><em>naming-java.jar</em> - Handler for the java: namespace.</li>
- <li><em>naming-resources.jar</em> - The specialized JNDI naming context
- implementation used to represent the static resources of a web
- application. This is not related to the support of the J2EE ENC, and
- cannot be removed.</li>
- <li><em>servlet-api.jar</em> - The Servlet 2.4 API.</li>
+ <li><em>annotations-api.jar</em> - JEE annotations classes.</li>
+ <li><em>catalina.jar</em> - Implementation of the Catalina servlet
+ container portion of Tomcat 6.</li>
+ <li><em>catalina-ant.jar</em> - Tomcat Catalina Ant tasks.</li>
+ <li><em>catalina-ha.jar</em> - High availability package.</li>
+ <li><em>catalina-tribes.jar</em> - Group communication package.</li>
+ <li><em>el-api.jar</em> - EL 2.1 API.</li>
+ <li><em>jasper.jar</em> - Jasper 2 Compiler and Runtime.</li>
+ <li><em>jasper-el.jar</em> - Jasper 2 EL implementation.</li>
+ <li><em>jasper-jdt.jar</em> - Eclipse JDT 3.2 Java compiler.</li>
+ <li><em>jsp-api.jar</em> - JSP 2.1 API.</li>
+ <li><em>servlet-api.jar</em> - Servlet 2.5 API.</li>
+ <li><em>tomcat-coyote.jar</em> - Tomcat connectors and utility classes.</li>
+ <li><em>tomcat-dbcp.jar</em> - package renamed database connection
+ pool based on Commons DBCP.</li>
<li><em>tomcat-i18n-**.jar</em> - 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>
</ul></li>
-<li><strong>Catalina</strong> - This class loader is initialized to include
- all classes and resources required to implement Tomcat 5 itself. These
- classes and resources are <strong>TOTALLY</strong> invisible to web
- applications. All unpacked classes and resources in
- <code>$CATALINA_HOME/server/classes</code>, as well as classes and
- resources in JAR files under
- <code>$CATALINA_HOME/server/lib</code>, are made visible through
- this class loader. By default, that includes the following:
- <ul>
- <li><em>catalina.jar</em> - Implementation of the Catalina servlet
- container portion of Tomcat 5.</li>
- <li><em>catalina-ant.jar</em> - Some Ant tasks which can be used to
- manage Tomcat using the manager web application.</li>
- <li><em>catalina-optional.jar</em> - Some optional components of
- Catalina.</li>
- <li><em>commons-modeler.jar</em> - A model MBeans implementation used
- by Tomcat to expose its internal objects through JMX.</li>
- <li><em>servlets-xxxxx.jar</em> - The classes associated with each
- internal servlet that provides part of Tomcat's functionality.
- These are separated so that they can be completely removed if the
- corresponding service is not required, or they can be subject to
- specialized security manager permissions.</li>
- <li><em>tomcat-coyote.jar</em> - Coyote API.</li>
- <li><em>tomcat-http.jar</em> - Standalone Java HTTP/1.1
- connector.</li>
- <li><em>tomcat-ajp.jar</em> - Classes for the Java portion of the
- <code>AJP</code> web server connector, which allows Tomcat to
- run behind web servers such as Apache and iPlanet iAS and iWS.</li>
- <li><em>tomcat-util.jar</em> - Utility classes required by some
- Tomcat connectors.</li>
- </ul></li>
-<li><strong>Shared</strong> - This class loader is the place to put classes
- and resources that you wish to share across <strong>ALL</strong>
- web applications (unless Tomcat internal classes also need access,
- in which case you should put them in the <strong>Common</strong>
- class loader instead). All unpacked classes and resources in
- <code>$CATALINA_BASE/shared/classes</code>, as well as classes and
- resources in JAR files under <code>$CATALINA_BASE/shared/lib</code>, are
- made visible through this class loader. If multiple Tomcat instances are
- run from the same binary using the $CATALINA_BASE environment variable,
- then this classloader repositories are relative to $CATALINA_BASE rather
- than $CATALINA_HOME.</li>
<li><strong>WebappX</strong> - A class loader is created for each web
- application that is deployed in a single Tomcat 5 instance. All unpacked
+ application that is deployed in a single Tomcat 6 instance. All unpacked
classes and resources in the <code>/WEB-INF/classes</code> directory of
your web application archive, plus classes and resources in JAR files
under the <code>/WEB-INF/lib</code> directory of your web application
instead of delegating before looking. There are exceptions. Classes which are
part of the JRE base classes cannot be overriden. For some classes (such as
the XML parser components in J2SE 1.4+), the J2SE 1.4 endorsed feature can be
-used
-(see the common classloader definition above).
+used.
Last, any JAR containing servlet API classes will be ignored by the
classloader.
-All other class loaders in Tomcat 5 follow the usual delegation pattern.</p>
+All other class loaders in Tomcat 6 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>
<li>System class loader classses (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>
-<li><em>$CATALINA_HOME/common/classes</em></li>
-<li><em>$CATALINA_HOME/common/endorsed/*.jar</em></li>
-<li><em>$CATALINA_HOME/common/i18n/*.jar</em></li>
-<li><em>$CATALINA_HOME/common/lib/*.jar</em></li>
-<li><em>$CATALINA_BASE/shared/classes</em></li>
-<li><em>$CATALINA_BASE/shared/lib/*.jar</em></li>
+<li><em>$CATALINA_HOME/lib</em></li>
+<li><em>$CATALINA_HOME/lib/*.jar</em></li>
</ul>
</section>
-<section name="XML Parsers and J2SE 1.4">
+<section name="XML Parsers and JSE 5">
-<p>Among many other changes, the J2SE 1.4 release packages the JAXP APIs, and
+<p>Among many other changes, the JSE 5 release packages the JAXP APIs, and
a version of Xerces, inside the JRE. This has impacts on applications that
wish to use their own XML parser.</p>
-<p>In previous versions of Tomcat 5, you could simply replace the XML parser
+<p>In previous versions of Tomcat, you could simply replace the XML parser
in the <code>$CATALINA_HOME/common/lib</code> directory to change the parser
used by all web applications. However, this technique will not be effective
-when you are running on J2SE 1.4, because the usual class loader delegation
+when you are running on JSE 5, because the usual class loader delegation
process will always choose the implementation inside the JDK in preference
to this one.</p>
-<p>JDK 1.4 supports a mechanism called the "Endorsed Standards Override
+<p>JDK 1.5 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://java.sun.com/j2se/1.4/docs/guide/standards/index.html">
-http://java.sun.com/j2se/1.4/docs/guide/standards/index.html</a>.</p>
+<a href="http://java.sun.com/j2se/1.5/docs/guide/standards/index.html">
+http://java.sun.com/j2se/1.5/docs/guide/standards/index.html</a>.</p>
<p>Tomcat utilizes this mechanism by including the system property setting
-<code>-Djava.endorsed.dirs=$CATALINA_HOME/common/endorsed</code> in the
-command line that starts the container. Therefore, you can replace the
-parser that is installed in this directory, and it will get used even on a
-JDK 1.4 system.</p>
+<code>-Djava.endorsed.dirs=$CATALINA_HOME/endorsed</code> in the
+command line that starts the container.</p>
</section>
to deploy a new web application, or undeploy an existing one, without having
to shut down and restart the entire container. In addition, you can request
an existing application to reload itself, even if you have not declared it
-to be <code>reloadable</code> in the Tomcat 5 server
+to be <code>reloadable</code> in the Tomcat 6 server
configuration file.</p>
-<p>To support these capabilities, Tomcat 5 includes a web application
+<p>To support these capabilities, Tomcat 6 includes a web application
(installed by default on context path <code>/manager</code>) that supports
the following functions:</p>
<ul>
<code>Host</code> configuration in your Tomcat <code>server.xml</code>
configuration. Here is an example:
<pre>
-<Context path="/manager" debug="0" privileged="true"
- docBase="/usr/local/kinetic/tomcat5/server/webapps/manager">
+<Context path="/manager" privileged="true"
+ docBase="/usr/local/kinetic/tomcat6/server/webapps/manager">
</Context>
</pre>
</li>
</ul>
</p>
-<p>Future versions of Tomcat 5 will include administrative functionality that
+<p>Future versions of Tomcat 6 will include administrative functionality that
is presented in (at least) the following forms:
<ul>
<li>As web services, so that Tomcat administration can be easily integrated
<blockquote><em>
<p>The description below uses the variable name $CATALINA_HOME
- to refer to the directory into which you have installed Tomcat 5,
+ to refer to the directory into which you have installed Tomcat 6,
and is the base directory against which most relative paths are
- resolved. However, if you have configured Tomcat 5 for multiple
+ resolved. However, if you have configured Tomcat 6 for multiple
instances by setting a CATALINA_BASE directory, you should use
$CATALINA_BASE instead of $CATALINA_HOME for each of these
references.</p>
<ul>
<li><em>MemoryRealm</em> - If you have not customized your
<code>$CATALINA_HOME/conf/server.xml</code> to select a different one,
- Tomcat 5 defaults to an XML-format file stored at
+ Tomcat 6 defaults to an XML-format file stored at
<code>$CATALINA_HOME/conf/tomcat-users.xml</code>, which can be
edited with any text editor. This file contains an XML
<code><user></code> for each individual user, which might
<code>RemoteAddrValve</code> or <code>RemoteHostValve</code>. Here is
an example of restricting access to the localhost by IP address:
<pre>
-<Context path="/manager" debug="0" privileged="true"
- docBase="/usr/local/kinetic/tomcat5/server/webapps/manager">
+<Context path="/manager" privileged="true"
+ docBase="/usr/local/kinetic/tomcat6/server/webapps/manager">
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127.0.0.1"/>
</Context>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to start the new web application.
- Check the Tomcat 5 logs for the details, but likely explanations include
+ Check the Tomcat 6 logs for the details, but likely explanations include
problems parsing your <code>/WEB-INF/web.xml</code> file, or missing
classes encountered when initializing application event listeners and
filters.</p>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to start the new web application.
- Check the Tomcat 5 logs for the details, but likely explanations include
+ Check the Tomcat 6 logs for the details, but likely explanations include
problems parsing your <code>/WEB-INF/web.xml</code> file, or missing
classes encountered when initializing application event listeners and
filters.</p>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to restart the web application.
- Check the Tomcat 5 logs for the details.</p>
+ Check the Tomcat 6 logs for the details.</p>
</blockquote></li>
<li><em>Invalid context path was specified</em>
<blockquote>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to enumerate the system properties.
- Check the Tomcat 5 logs for the details.</p>
+ Check the Tomcat 6 logs for the details.</p>
</blockquote></li>
</ul>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to enumerate the global JNDI
- resources. Check the Tomcat 5 logs for the details.</p>
+ resources. Check the Tomcat 6 logs for the details.</p>
</blockquote></li>
<li><em>No global JNDI resources are available</em>
<blockquote>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to start the web application.
- Check the Tomcat 5 logs for the details.</p>
+ Check the Tomcat 6 logs for the details.</p>
</blockquote></li>
<li><em>Invalid context path was specified</em>
<blockquote>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to stop the web application.
- Check the Tomcat 5 logs for the details.</p>
+ Check the Tomcat 6 logs for the details.</p>
</blockquote></li>
<li><em>Invalid context path was specified</em>
<blockquote>
<li><em>Encountered exception</em>
<blockquote>
<p>An exception was encountered trying to undeploy the web application.
- Check the Tomcat 5 logs for the details.</p>
+ Check the Tomcat 6 logs for the details.</p>
</blockquote></li>
<li><em>Invalid context path was specified</em>
<blockquote>
<section name="Executing Manager Commands With Ant">
<p>In addition to the ability to execute Manager commands via HTTP requests,
-as documented above, Tomcat 5 includes a convenient set of Task definitions
+as documented above, Tomcat 6 includes a convenient set of Task definitions
for the <em>Ant</em> (version 1.4 or later) build tool. In order to use these
commands, you must perform the following setup operations:</p>
<ul>
You must use version <strong>1.4</strong> or later.</li>
<li>Install the Ant distribution in a convenient directory (called
ANT_HOME in the remainder of these instructions).</li>
-<li>Copy the file <code>server/lib/catalina-ant.jar</code> from your Tomcat 5
+<li>Copy the file <code>server/lib/catalina-ant.jar</code> from your Tomcat 6
installation into Ant's library directory (<code>$ANT_HOME/lib</code>).
</li>
<li>Add the <code>$ANT_HOME/bin</code> directory to your <code>PATH</code>