Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Tomcat in the enterprise

Learn where Tomcat fits, and doesn't, in your enterprise application stack

  • Print
  • Feedback

Page 4 of 4

Using Tomcat as an application server

Building scalable solutions

It is not uncommon for Java enterprise applications to scale along the lines suggested by the example in this article, growing in complexity as new requirements are added. While Tomcat (or any Web server) might suit your initial application requirements, it could become problematic in the long run, as the system gradually requires more complex deployment, management, and monitoring solutions. A Java EE application server is more scalable than a Web server, providing tight integration between containers and deployment contexts for each additional technology. In many cases, choosing a Java EE app server is the more cost-effective solution for the long run.

As the evolving application example in the previous section shows, Apache Tomcat can be used as an application server, especially for less complex Java EE Web applications. According to some figures, Tomcat is the Web/application server environment most used by Java developers. Tomcat's popularity is due to its ease of use and support for many features considered to be standard in a Java Web application environment, including WAR file deployment, JNDI resources, JDBC data sources, JSP support, session replication, virtual hosting support, clustering support, and JMX-based management and monitoring. Tomcat is also a favorite for Java enterprise development due to the fact that its runtime performance as a standalone server is very competitive.

With Tomcat version 6, some new features have been added including asynchronous HTTP request handling via Comet, thread pool sharing, non-blocking connectors, enhanced JMX management and monitoring, Servlet 2.5, and JSP 2.1.

Even with these new features, however, Tomcat does not support the entire Java EE stack. Where Tomcat and other Web servers fall short is in the area of features such as distributed transactions, EJBs, and JMS. Applications requiring support for these components are usually more at home in with a Java EE application server such as JBoss, Geronimo, WebLogic, WebSphere, or Glassfish. Many Java EE application servers actually use Tomcat as their Web container.

In conclusion

The formal distinction between Java EE application servers and Web servers is clear, but the real-world distinction is less obvious. While Tomcat is not strictly speaking an application server, this article has shown that it works quite well in that capacity, up to a point.

When attempting to determine the server environment best suited to a particular application or system, it is helpful to break down the requirements of the system and determine which Java EE components will need to be supported. For simpler Web applications that will not scale much, Tomcat is a fast, reliable, lightweight solution. For more complex enterprise applications, SOAs, or even highly scalable Web applications, a full-fledged Java EE application server is usually the more cost-effective choice.

About the author

Jeff Hanson has more than 20 years experience as a software engineer, including working as senior engineer for the Windows OpenDoc project and as chief architect for the Zareus SOA platform. The author of numerous articles and books, he is the chief architect for Max Software Inc., where he leads design and implementation teams building desktop and server applications for the content-control industry using C++, PHP, and JEE.

Read more about Tools & Methods in JavaWorld's Tools & Methods section.

  • Print
  • Feedback

Resources