Glassfish vs Tomcat
The stack we're using now to build applications for Sunburnt SEO is so close to being a complete Java EE 5.0 environment that I've been giving some thought to dumping support for the old Servlet 2.4 environment altogether. We're now deploying JPA 1.0, JSF 1.2, EL 1.0, JSTL, Mail and Activation jars which account for over 65% of the download size and are all included in a Java EE 5.0 server.
Then there's the other advantages of Java EE 5.0 like dependency injection, transaction management and hooks for automatic Entity enhancement. Needless to say, I'd be quite happy to upgrade.
Well, what better way to decide about an upgrade than to build a comparison matrix? Lets have a look then - a comparison to Tomcat is all I'm really interested in here, although one of the key features of our software is its multisites capability, so support for virtual hosting is especially important.Glassfish vs Tomcat
|1||Adoption levels||high||low||Glassfish is new|
|2||Scalable||ok||yes||Glassfish has grizzly|
|3||Includes Java EE 5 jars||no||yes|
|3||Container managed transactions||no||yes|
|3||OpenJPA entities enhanced automatically||no||yes|
|4||JDBC authentication||yes||yes||In Glassfish 1.0.1|
|Virtual server features|
|1||Support for virtual hosting||yes||yes|
|1||Deploy same webapp to multiple hosts||yes||yes|
|1||Configure same webapp differently||yes||no||Possible in Tomcat's context.xml or server.xml|
|2||Per virtual host logging||ok||yes||Tomcat's JULI is a bit buggy , |
|2||Each host has their own authentication realm||yes||no|
|3||Each host has their own deployment dir||yes||no|
|4||Each host has a jailed manager||yes||no|
|4||Each host can listen on a different port||ok||yes||Tomcat requires an additional <Service> containers |
|5||Each host can listen on an arbitrary combination of ports||no||yes||For Tomcat, a host in one <Service> cannot share ports with a host in another <Service> |
The main problem with Glassfish is that its virtual hosting features don't meet our requirements. In Glassfish, webapps don't live in a single virtual host, they are mapped to one or more virtual hosts. This is why you can't have a single deployment directory or jailed manager per virtual host. Additionally, it appears that instances of webapps in Glassfish can't be individually configured by setting environment variables in the config file (the <web-app> section is practically empty) and they cannot be mapped to the same context path even if they are deployed to different hosts.
Glassfish looks great, but the problems above are show stopper for us, so we have to stay with Tomcat unless I come up with a way to do these things in Glassfish.
Five and half years later and Tomcat is still our server of choice. After trying to upgrade several times to Glassfish we just keep hitting stopper bugs that make me wonder if anybody actually uses it for anything more than "Hello World" applications.
Tomcat might be old and boring, but it is fast, stable and doesn't have buggy features.
Roger Keays is an artist, an engineer, and a student of life. Since he left Australia in 2009, he has been living as a digital nomad in over 40 different countries around the world. Roger is addicted to surfing. His other interests are music, psychology, languages, and finding good food. Click here to subscribe to his weekly blog, or stalk him on Facebook and Twitter.