Tomcat is a servlet container that can host JSP and servlets. GlassFish is a Java EE 5-compliant
application server that includes implementation for a Web services stack (Metro
), EJBs, Java Persistence, and many others included in the Java EE 5 specification.
GlassFish also provides the out-of-the-box clustering, centralized administration, high availability, and load balancing capabilities required for enterprise applications. The GlassFish web container is a fork of Tomcat 5.5. Why a fork? The Tomcat folks were making incompatible interface changes while GlassFish was trying to stabilize the code base (not a complaint, just reality). This GlassFish and Tomcat Comparison page also lists differences.
Think GlassFish is too big, and forces you to run more than you really need
? The "all-or-nothing" nature of GlassFish goes away in GlassFish v3. The modular architecture of GlassFish v3 will provide lightweight, more "Tomcat-like" distribution options and enable you to roll out as much or as little of the GlassFish server as you need. Item A on the GlassFish v3 Themes page (Modularity and Extensibility) describes what's planned.
NOTE: This "What is the difference..." question was one of many questions answered in the following blog posts from Arun
, which might also be of interest:
http://blogs.sun.com/arungupta/entry/glassfish_delhi_university
http://blogs.sun.com/arungupta/entry/glassfish_bangalore_chennai_and_pune
All of Arun's Q & A blog entries are available here.