The first stable build of Tomcat 6, which implements the Sun Servlet 2.5 Specification and JSP 2.1, was released in 2007, and has since reached version 6.0.26, released in March of 2010, as Tomcat's developer community has continued to improve the branch. In the three years since its release, Tomcat 6 has become one of the most popular Java application servers in the world, due in part to the growing number of companies now favoring Tomcat-based production architectures over stack-based Java EE servers.
In this article, we'll take a look at the new specifications implemented in this version of Tomcat, new features and improvements, and learn how to migrate to Tomcat 6 from Tomcat 5.5. We'll also glance at the future of the Apache Tomcat servlet container, with an overview of some features you can look forward to in Tomcat 7 and what you'll need to do in order to get your servers up to date when version 7 is released later this year.
, the leading enterprise Apache Tomcat application server, fully supports Tomcat 6, and already supports the Tomcat 7 beta! Tcat provides key enterprise features to your entire Tomcat infrastructure, such as improved deployment, configuration management, deep diagnostics, and reliable restarts. Try Tcat
Tomcat 6 and Servlet 2.5
Although new releases of the Java Servlet specification are a primary driving force for Tomcat development, many of Tomcat 6's new features are related to the implementation of JSR 250 and JSP 2.1.
The main goal in Servlet 2.5 was to sharpen and clarify certain concepts introduced in previous versions, as well as to make updated version requirements for supporting technologies firm, in order to prepare for future development. For example, although annotations were technically supported in previous versions of the specification, Servlet 2.5 made them a firm requirements for an implementation to be considered compliant.
Tomcat 6 and JSP 2.1
Many of the most exciting new features supported by Tomcat 6 are related to Tomcat's implementation of the JSP 2.1 specification. This version of the specification formally introduced Expression Language as a solidified concept covered by its own specification.
Expression Language allows JavaBean data to be accessed via a simple naming syntax, rather than complex Java code inserted into the JSP document. This is related to the specification's support for the Java Standard Tag Library (JSTL) and JavaServer Faces.
The JSP 2.1 specification also explicitly supports Java annotations, as well as additional features such as resource injection in JSP code.
New Features In Tomcat 6
In addition to features supported as part of the updated JSP and Servlet specifications, Tomcat includes a number of new features. These features include:
- A new NIO connector allows asynchronous communication of low-level I/O data. This allows Tomcat users to implement advanced control over their applications' I/O operations, such as multiplexing through selectors or bulk data transfer at multiple I/O levels in parallel.
- The new Executor element allows users to configure injectable thread pools that can be shared between multiple applications.
- The new Tomcat JULI framework, which refactors the java.util.logging library to explicitly support a container-based environment, and allows the implementation of an alternate commons-logging adaptor such as Log4J.
- Support for Comet, a new HTTP Push method, and the SEND_FILE API, which allows file transfers over a socket connection.
- Changes to the configuration rules allow users to define multiple url-pattern elements within a single servlet-mapping element.
Upgrading From Tomcat 5.5 To Tomcat 6
A major consideration in the development of Tomcat 6 (which is echoed in the JSRs that led to Servlet 2.5 and JSP 2.1) was improving the simplicity of server configuration, while preserving flexibility and backwards compatibility.
Thus, while it is a good idea for users to consider how implementing some of Tomcat 6's new features into applications might provide improved functionality, from a pure compatibility standpoint, upgrading a Tomcat 5.5 server infrastructure to Tomcat 6 is simple. The same goes for Tomcat 5, which is based on the same specification.
The biggest change you'll need to be aware of is Tomcat 6's merge of the common, shared, and server repositories into a single folder, "$CATALINA_HOME/lib". To comply with this change, simply move any extra components you may have installed in one of the separate library directories into the new combined "lib" folder. Note that this directory change also affects classloaders, which have been merged in the same fashion.
The new JULI logging system does not require any additional configuration, but if you are going to the log4j package with Tomcat, you'll need to follow some additional configuration steps. For your convenience, we have created a Tomcat Logging guide, which includes step-by-step instructions you can follow to configure log4j.
Other than directory and logging changes, the only other major migration considerations are the SSL Connector's "SSLEnabled" attribute, which must now be set to "true" if you want to use encryption, and your Java version - Java 5 is now required!
As of May 2010, Tomcat 6 is still considered the most current stable branch, but Tomcat 7, which implements the new Servlet 3 specification and Java 6, as well as a wide variety of new features and bug fixes, is close to release. Originally expected in December of 2009, the estimated release date is now late summer 2010. New features include improved asynchronous support, dynamic configuration, extended support for annotations, and long-awaited improvements to Tomcat's memory leak handling.
For more information about changes and new features in this upcoming release, visit our Tomcat 7 page, which we will be regularly updating with build news and more until the Tomcat 7 release!