Content

Table of Contents

General

Please read general Migration Guide page first, for common considerations that apply to migration or upgrade between versions of Apache Tomcat.

Migrating from 7.0.x to 8.0.x

This section lists all the known changes between 7.0.x and 8.0.x which may cause backwards compatibility problems when upgrading.

Java 7 required

Apache Tomcat 8.0.x requires Java 7 or later. Apache Tomcat 7.0.x required Java 6.

Specification APIs

Apache Tomcat 8 supports the Java Servlet 3.1, JavaServer Pages 2.3, Java Unified Expression Language 3.0 and Java WebSocket 1.0 specifications. The changes between versions of specifications may be found in the Changes appendix in each of specification documents.

Servlet 3.1 API

In JSP pages that use wildcard import syntax the new classes added in Servlet API may conflict with ones in web applications. For example, if package "a" contains class ReadListener, the following JSP page will cease to compile in Tomcat 8:

<%@page import="a.*"%>
<% ReadListener listener = new ReadListener(); %>

This happens because implicit import of javax.servlet.* and explicit import of a.* will provide conflicting definitions of class ReadListener that was added in Servlet 3.1. The solution is to use the explicit import, import="a.ReadListener".

Default connector implementation

The default HTTP and AJP connector implementation has switched from the Java blocking IO implementation (BIO) to the Java non-blocking IO implementation (NIO). BIO may still be used but Servlet 3.1 and WebSocket 1.0 features that use non-blocking IO will then use blocking IO instead which may cause unexpected application behavior.

Web application resources

The Aliases, VirtualLoader, VirtualDirContext, JAR resources and external repositories features that all provided a way to add resources to a web application have been replaced with a single framework rather than each being implemented separately (this was becoming increasingly difficult to maintain). The resources documentation provides details on how the new implementation may be used.

The refactoring of resources has also resulted in a number of attributes being removed from the default Context implementation (org.apache.catalina.core.StandardContext). The following attributes may now be configured via the resources implementation used by the web application:

  • allowLinking
  • cachingAllowed
  • cacheMaxSize
  • cacheObjectMaxSize
  • cacheTTL

Database Connection Pooling

Tomcat 8 embeds a packaged renamed version of Commons DBCP 2.x. There are a number of notable changes between Commons DBCP 1.x and Commons DBCP 2.x which are likely to require configuration changes.

  • The maxActive configuration option has been renamed to maxTotal
  • The maxWait configuration option has been renamed to maxWaitMillis
  • The JDBC driver JAR may be placed in WEB-INF/lib as an alternative to $CATALINA_BASE/lib provided that the driver class is only used by that web application.
  • Connection validation no longer requires both a validation query and at least one of the testXxx attributes to be set to true. If no validation query is defined and at least one of the testxxx attributes is true, connections will be validated using Connection.isValid().

Additionally, Commons DBCP has added a number of new configuration options. These should be reviewed to determine which, if any, should be used.

Clustering

The addition of the HttpServletRequest.changeSessionId() method in Servlet 3.1 made the org.apache.catalina.ha.session.JvmRouteSessionIDBinderListener unnecessary so it has been removed. It must be removed from cluster configurations when upgrading to Tomcat 8.

Debugging

When starting Tomcat with the jpda option to enable remote debugging, Tomcat 8 listens on localhost:8000 by default. Earlier versions listened on *:8000. If required, this default can be overridden by setting the JPDA_ADDRESS environment variable in, for example, setenv.[bat|sh].

Internal APIs

Whilst the Tomcat 8 internal API is broadly compatible with Tomcat 7 there have been many changes at the detail level and they are not binary compatible. Developers of custom components that interact with Tomcat's internals should review the JavaDoc for the relevant API.

Of particular note are:

  • The Manager, Loader and Resources have moved from Container to Context since Context is the only place they are used.
  • The Mapper has moved from the Connector to the Service since the Mapper is identical for all Connectors of a given Service.
  • A new Resources implementation that merges Aliases, VirtualLoader, VirtualDirContext, JAR resources and external repositories into a single framework rather than a separate one for each feature.

Upgrading 8.0.x

When upgrading instances of Apache Tomcat from one version of Tomcat 8 to another, particularly when using separate locations for $CATALINA_HOME and $CATALINA_BASE, it is necessary to ensure that any changes in the configuration files such as new attributes and changes to defaults are applied as part of the upgrade. To assist with the identification of these changes, the form below may be used to view the differences between the configuration files in different versions of Tomcat 8.

Tomcat 8.0.x configuration file differences

Select a configuration file, old version and new version from the boxes below and then click "View differences" to see the differences. The differences will be shown in a new tab/window.

You can also use Subversion command similar to the following (all on one line):

svn diff
  --old=http://svn.apache.org/repos/asf/tomcat/tc8.0.x/tags/TOMCAT_8_0_1/conf/
  --new=http://svn.apache.org/repos/asf/tomcat/tc8.0.x/tags/TOMCAT_8_0_3/conf/