O'Reilly logo

Professional Apache Tomcat 6 by Jeff Genender, Sing Li, Vivek Chopra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18. Embedded Tomcat

Ever since the initial availability of the Tomcat server, some developers have wanted or needed to create applications that have full control over the server's lifecycle and internal operation. When the entire Tomcat server is contained within a custom application, it is said to be operating in embedded mode. While provisions were made for embedding Tomcat into applications in past releases (as far back as Tomcat 3.x), these older provisions were rather ad hoc and problem-prone because the earliest versions of Tomcat did not account for the embedded mode of operation. Tomcat 5 changed this landscape completely. Embedded operation is an explicitly supported mode, and Tomcat 6 and future Tomcat designs will evolve to satisfy the emerging requirements from embedded users.

This chapter explores the embedded mode of Tomcat 6 in the following areas:

  • Why embedding Tomcat may be important for many projects

  • Programmatically embedding Tomcat

  • Developing a real embedded Tomcat application

Hands-on examples are provided so that you can experiment with configuring embedded Tomcat instances. This chapter focuses more on the under-the-hood aspects of embedded Tomcat implementations.

By the end of this chapter, you should have a comprehensive understanding of why you might use embedded mode and how to operate Tomcat in embedded mode. You will be able to facilitate the creation of applications and systems that operate embedded Tomcat instances.

Tomcat versions before 6.x included ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required