What's the difference between a web server, an application server, and a servlet container?
Is Tomcat an application server?
What's the difference between Tomcat and JBoss/Geronimo?
In the strictest sense, one could say: A web server serves up static
HTML pages and nothing else. Tomcat is a Servlet/JSP container, and
'Java application servers' are those which support the full JEE
(formerly J2EE) stack.
The distinctions between these terms, however, have always been
blurry, and continue to become more so over time, and will vary
depending on where and with whom your discussion takes place. To
understand this requires a little history lesson.
Tomcat started its life as the JServ module for Apache HTTPD
(now known as the Apache web server).
It was only a servlet container and was incapable of handling web
requests on its own. When combined, HTTPD would handle all web
requests, would serve up all the static content on its own and forward
any dynamic requests to JServ. Httpd was the web server and JServ was
the servlet container.
Eventually, JServ was replaced by the Tomcat application
server, and a connector was added that allowed Tomcat to operate as a
standalone web/application server. At the time Tomcat alone was not
fast enough for use in heavy traffic production environments, and
didn't support SSL so it was standard practice to combine Tomcat with
the Apache web server; much in the same way that JServ and httpd were
used. This is still not uncommon today and there are still valid
reasons for wanting to do so.
Over time, both Tomcat and the Java Virtual machine, with its
Just In Time compiler, have made huge gains in performance, and in many
cases running Tomcat as a standalone application server is just as fast
or faster than running it in conjunction with the Apache web server.
(Testing your application in both configurations under load is the only
way to know for sure). Tomcat also has full support for SSL.
So, as you can see, in the case of Tomcat, the lines between application server and web server have blurred over the years.
The lines are also somewhat blurry when you look at the Apache
web server itself. It has been hosting large commercial applications
using CGI (Common Gateway Interface) for over a dozen years. In
addition, many modules, such as the one that allows the popular PHP
scripting language to run natively, have become almost standard in an
Apache web server installation.
Another popular web/application server, Microsoft's IIS
(Internet Information Server), is also used as both a web server and
application server. It too can be configured to pass requests for
dynamic content to Tomcat via an ISAPI filter. It can also be
configured to support popular scripting languages such as PHP, and has
native support for Microsoft's own ASP and ASP.NET platforms. Here
also, the distinction between web server and application server is
blurry.
In some circles, in order to qualify as a "Java application server" the
server must support the entire JEE (formerly known as J2EE) stack.
Tomcat does not do this. It does not support EJB (Enterprise Java
Beans), amongst other APIs. JBoss and Apache's Geronimo application
server do support the entire JEE stack. Their servlet and JSP
capabilities come from an embedded version of Tomcat (or some other
servlet container).
Since one actually contains and relies on the other, the
question "Which is better - Tomcat or JBoss" or the phrase, "Tomcat vs
JBoss" is not answerable. They are not legitimate comparisons.
Many large, commercial applications are hosted on Tomcat; both with and without an external HTTP web server and without EJB.
To sum it up, the terms do exist but need to be considered in
the context of their use in order to understand what they really mean.