The Servlet Shop Java Web Development: Choosing a Servlet/JSP Container

This document is also available in Serbo-Croatian language. Thanks to Anja Skrba for translating it!

In order to run your servlets, JSPs and Java web applications you need a "servlet container". A servlet container is a piece of software which runs on a computer connected to a network, and processes incoming page requests, turning them into generated pages. In many ways a servlet container is similar to a web server, like Apache or IIS, and indeed several servlet containers will also function as a web server if required. Some servlet containers are designed to work best in conjunction with a separate web server, some are designed to work best "stand alone", and some will work just as effectively either way.

You can get and run a servlet container providing pages to the internet in several ways:

Whichever route to putting your Java code on the web you choose, you would do well to understand the differences between the different available servlet container software. That way you can both evaluate hosting offerings that include Java as standard, and choose which software to install if you plant to do it yourself. Here is a selection of some of the major current players. I'll try to keep this list as up-to-date as I can, but software is always a moving target. If you spot anything missing or which is glaringly out of date, please let me know.

Resin 2.1Servlet: 2.3 JSP: 1.2 Cost: Free/$500 Source: yes
I use Resin 2.1 for most of my Java web development at the moment. It's well-written, well supported, and above all fast. It's quick to start up, reliably detects hot-deployed web-application "war" files and does its best to give sensible error messages when things go wrong, which makes it great for use during development. Luckily, it's also free for development and experimentation. You only need to pay for a licence if you (or your employer) is making money out of using Resin.

Resin will play nicely as an extension to a web server, but generally performs even better when used "stand-alone".

Although Resin 2.1 is still being maintained, that's only to cover bugfixes and security updates. If you need features from Servlets 2.4 or JSP 2.0, you should probably look at Resin 3, instead.

Publisher: caucho.com read more download )

Resin 3.0Servlet: 2.4 JSP: 2.0 Cost: Free/$500 Source: yes
Some fairly major changes were needed from the Resin 2.1 code base to support the new features of Servlets 2.4 and JSP 2.0, so a whole new version of Resin was produced. Resin 3.0 only came out of beta in September 2003, and although it is production-quality, it is still changing fairly regularly. It doesn't help that the Servlet 2.4 and JSP 2.0 APIs are still only at the "final draft" stage. Note also that changes in the specification for things like deployment descriptors between Servlets 2.3 and Servlets 2.4 may mean that web applications written for the 2.3 API may need minor "tweaking" to work with this container.

That said, if you are starting a new Java web project, this would likely be a good container to build it with. The new APIs will become the defacto standard soon enough, and there's little point limiting your options and ignoring all the neat new features.

Publisher: caucho.com ( read more download )

Tomcat 4Servlet: 2.3 JSP: 1.2 Cost: Free Source: yes
Tomcat is the "reference implementation" of the Servlet and JSP APIs. What this is supposed to mean is that if an area of the written specification is ambiguous or unclear, the way that Tomcat implements it defines the way it should work. In practice this seems sometimes to be taken as meaning that Tomcat can ignore or redefine the specification, much to the irritation of other container writers who struggle to implement the exact letter of the spec.

Tomcat 4 is the current production release of Tomcat. There is a Tomcat 5, which implements the Servlet 2.4 and JSP 2.0 APIs, but that is currently still only a beta release. Tomcat is free for both commercial and development use, which is why it is popular with hosting companies, but it can seem clumsy and sometimes slow compared with some other servers. Personally, I don't like Tomcat much for use during development, it is not very good at monitoring a directory and hot-deploying or hot-updating web applications, instead relying on a web service to tell it what is new. This shouldn't matter too much on a live server, where application deployment or update is relatively rare, though. Although Tomcat will work as a stand-alone web server, it seems to be primarily designed to work as an extension to a web server such as Apache.

Publisher: Jakarta ( read more download )

Jetty 4Servlet: 2.3 JSP: 1.2 Cost: Free Source: yes
Jetty is another major player in the free servlet container game. Jetty has the advantage of being generally small and fast, and is particularly suited to stand-alone applications, or as an embedded web server to provide a web interface to another project.

Publisher: Mort Bay Consulting ( read more download )

bjServerServlet: 2.3 JSP: 1.2 Cost: Free Source: no?
Notthing like as well known as the "big boys", but definately worth a download. This is one of the few servlet containers that can run web applications straight from a "war" file without extracting them to a filesystem first. I use it as a test case to make sure that my web applications run in the full range of containers. bjServer is already fast and small, and the author is continually improving this software.

Publisher: Bajie ( read more download )

ResumeEdge.com: Get a Resume that Gets Results!

GuruNet - Go Beyond Search!

Hot Summer Savings from LearnKey