Book description
Tomcat is the official reference implementation of Sun's servlet and JSP specifications, and Java developers must test all Web applications on Tomcat to ensure they work as designed
Boasting more than 40 percent new and updated material, this book covers all the major new features affecting server administration and management
Explores the additional built-in tools of Tomcat, which help Java developers program more efficiently, and looks at how Apache's other open source servlet/JSP technologies are designed to work with Tomcat
Features full coverage of Release 6, which supports the latest JSP and servlet specifications: JSP 2.1 and Servlets 2.5
Addresses solving real-world problems encountered during all phases of server administration, including managing class loaders and connectors, security, shared hosting and clustering, and system testing
Table of contents
- Copyright
- About the Authors
- Credits
- Introduction
- 1. Apache Tomcat
-
2. Web Applications: Servlets, JSPs, and More
- 2.1. A Brief History of Web Applications
- 2.2. Using Appropriate Web Technologies
- 2.3. Building and Distributing Web Applications
- 2.4. Summary
-
3. Tomcat Installation
- 3.1. Installing the Java Virtual Machine
-
3.2. Installing Tomcat
- 3.2.1. Deciding Which Distribution to Install
- 3.2.2. Verifying the Downloaded File
- 3.2.3. Tomcat Windows Installer
- 3.2.4. Installing Tomcat on Windows Using the ZIP File
- 3.2.5. Installing Tomcat on Linux
- 3.3. Building Tomcat from Source
- 3.4. The Tomcat Installation Directory
- 3.5. Installing APR
- 3.6. Troubleshooting and Tips
- 3.7. Summary
- 4. Tomcat Architecture
-
5. Basic Tomcat Configuration
- 5.1. Tomcat 6 Configuration Essentials
- 5.2. Files in $CATALINA_HOME/conf
-
5.3. Basic Server Configuration
- 5.3.1. Server Configuration via the Default server.xml
- 5.3.2. Operating Tomcat in Application Server Configuration
- 5.3.3. Web Application Context Definitions
- 5.3.4. Authentication and the tomcat-users.xml File
- 5.3.5. The Default Deployment Descriptor — web.xml
- 5.3.6. Configuring the Invoker Servlet
- 5.3.7. Configuring the JspServlet
- 5.3.8. SSI and CGI Servlets Configuration
- 5.3.9. Matching URLs: Servlet Mappings
- 5.3.10. How server.xml, Context Descriptors, and web.xml Work Together
- 5.3.11. SSI and CGI Mappings
- 5.3.12. Fine-Grained Access Control: catalina.policy
- 5.3.13. catalina.properties: Finer-Grained Control over Access Checks
- 5.3.14. Bootstrapping Configuration
- 5.3.15. A Final Word on Differentiating Between Configuration and Management
- 5.4. Tomcat 6 Web-Based GUI Configurator
- 5.5. Summary
-
6. Advanced Tomcat Features
- 6.1. Valves — Interception Tomcat-Style
- 6.2. Standard Valves
- 6.3. Access Log Implementation
- 6.4. Scope of Log Files
- 6.5. Single Sign-On Implementation
- 6.6. Form Authenticator Valve
- 6.7. Restricting Access via a Request Filter
- 6.8. Persistent Sessions
-
6.9. JNDI Resource Configuration
- 6.9.1. What Is JNDI?
- 6.9.2. Tomcat and JNDI
- 6.9.3. Typical Tomcat JNDI Resources
- 6.9.4. Configuring Resources via JNDI
- 6.9.5. The <Environment> Element
- 6.9.6. The <Resource> Element
- 6.9.7. The <ResourceParams> Element
- 6.9.8. The <ResourceLink> Element
- 6.9.9. Configuring a JDBC DataSource
-
6.9.10. Configuring Mail Sessions
- 6.9.10.1. Adding a Resource Definition to the Application Context Descriptor
- 6.9.10.2. Adding a Reference to a Mail Session Resource in the Deployment Descriptor
- 6.9.10.3. Downloading and Installing JavaMail 1.3.3 and the JavaBeans Activation Framework 1.1 Libraries
- 6.9.10.4. Compiling and Configuring the SendMailServlet
- 6.9.10.5. Creating the sendmail.jsp JSP
- 6.9.10.6. Sending E-mail via JavaMail Sessions
- 6.10. Configuring Lifecycle Listeners
- 6.11. Summary
-
7. Web Application Configuration
- 7.1. Understanding the Contents of a Web Application
-
7.2. Understanding the Deployment Descriptor (web.xml)
-
7.2.1. The Servlet 2.3-Style Deployment Descriptor
- 7.2.1.1. The XML Header
- 7.2.1.2. The DTD Declaration
- 7.2.1.3. <web-app>
- 7.2.1.4. <icon>
- 7.2.1.5. <display-name>
- 7.2.1.6. <description>
- 7.2.1.7. <distributable>
- 7.2.1.8. <context-param>
- 7.2.1.9. <filter>
- 7.2.1.10. <listener>
- 7.2.1.11. <servlet>
- 7.2.1.12. <session-config>
- 7.2.1.13. <mime-mapping>
- 7.2.1.14. <welcome-file-list>
- 7.2.1.15. <error-page>
- 7.2.1.16. <taglib>
- 7.2.1.17. <resource-ref>
- 7.2.1.18. <security-constraint>
- 7.2.1.19. <web-resource-collection>
- 7.2.1.20. <auth-constraint>
- 7.2.1.21. <user-data-constraint>
- 7.2.1.22. <login-config>
- 7.2.1.23. <security-role>
- 7.2.1.24. <env-entry>
-
7.2.2. The Servlet 2.4/2.5-Style Deployment Descriptor
- 7.2.2.1. web-app
- 7.2.2.2. context-param
- 7.2.2.3. description
- 7.2.2.4. display-name
- 7.2.2.5. distributable
- 7.2.2.6. ejb-local-ref
- 7.2.2.7. ejb-ref
- 7.2.2.8. env-entry
- 7.2.2.9. error-page
- 7.2.2.10. filter
- 7.2.2.11. filter-mapping
- 7.2.2.12. icon
- 7.2.2.13. jsp-config
- 7.2.2.14. listener
- 7.2.2.15. locale-encoding-mapping-list
- 7.2.2.16. login-config
- 7.2.2.17. message-destination
- 7.2.2.18. message-destination-ref
- 7.2.2.19. mime-mapping
- 7.2.2.20. resource-env-ref
- 7.2.2.21. resource-ref
- 7.2.2.22. security-constraint
- 7.2.2.23. security-role
- 7.2.2.24. service-ref
- 7.2.2.25. servlet
- 7.2.2.26. servlet-mapping
- 7.2.2.27. session-config
- 7.2.2.28. welcome-file-list
-
7.2.1. The Servlet 2.3-Style Deployment Descriptor
- 7.3. Summary
-
8. Web Application Administration
- 8.1. Sample Web Application
- 8.2. Tomcat Manager Application
- 8.3. Tomcat Manager: Web Interface
- 8.4. Deploying a Web Application
- 8.5. Tomcat Manager: Managing Applications with Ant
-
8.6. Tomcat Manager — Using HTTP Requests
- 8.6.1. List Deployed Applications
- 8.6.2. Deploying a New Application
- 8.6.3. Installing/Deploying Applications in Tomcat 6
- 8.6.4. Deploying a New Application Remotely
- 8.6.5. Deploying a New Application from a Local Path
- 8.6.6. Reloading an Existing Application
- 8.6.7. Listing Available JNDI Resources
- 8.6.8. Listing OS and JVM Properties
- 8.6.9. Stopping an Existing Application
- 8.6.10. Starting a Stopped Application
- 8.6.11. Undeploying a Web Application
- 8.6.12. Displaying Session Statistics
- 8.6.13. Querying Tomcat Internals Using the JMX Proxy Servlet
- 8.6.14. Setting Tomcat Internals Using the JMX Proxy Servlet
- 8.7. Possible Errors
- 8.8. Security Considerations
- 8.9. Tomcat Deployer
- 8.10. Summary
-
9. Class Loaders
- 9.1. Class Loader Overview
- 9.2. Security and Class Loaders
- 9.3. Tomcat and Class Loaders
- 9.4. Common Class Loader Pitfalls
- 9.5. Summary
-
10. Http Connectors
- 10.1. HTTP Connectors
- 10.2. Configuring Tomcat for CGI Support
- 10.3. Configuring Tomcat for SSI Support
- 10.4. Running Tomcat Behind a Proxy Server
- 10.5. Performance Tuning
- 10.6. Front-Ending Tomcat 6 with a Web Server
- 10.7. Summary
-
11. Tomcat and Apache HTTP Server
- 11.1. The AJP Connector Architecture
- 11.2. Apache Web Server Frontend or Tomcat Standalone
- 11.3. Understanding Tomcat Workers
- 11.4. Connecting Tomcat with Apache
-
11.5. Configuring SSL for Apache Web Server
- 11.5.1. Configuring mod_ssl for Apache
- 11.5.2. Testing the SSL-Enabled Apache Setup
- 11.5.3. SSL-Enabled Apache-Tomcat Setup
-
11.6. Tomcat Load Balancing with Apache
- 11.6.1. Changing CATALINA_HOME in the Tomcat Startup Files
- 11.6.2. Setting Different AJP Connector Ports
- 11.6.3. Setting Different Server Ports
- 11.6.4. Disabling the Default HTTP/1.1 Connector
- 11.6.5. Setting the jvmRoute in the Standalone Engine
- 11.6.6. Commenting Out the Catalina Engine
- 11.6.7. Directives in httpd.conf
- 11.6.8. Workers Configuration in workers.properties
- 11.7. Testing the Load Balancer
- 11.8. Summary
-
12. Tomcat and IIS
- 12.1. Role of the ISAPI Plug-in
-
12.2. Connecting Tomcat with IIS
- 12.2.1. Verifying Tomcat and IIS Installations
- 12.2.2. Configuring the JK Connector
- 12.2.3. Installing the ISAPI Plug-in
- 12.2.4. Configuring Tomcat Workers
- 12.2.5. Configuring the Request Forwarding Rules
- 12.2.6. Optionally Configure URL Rewrite Rules
- 12.2.7. Updating the Windows Registry for the ISAPI Plug-in
- 12.2.8. IIS 5 Isolation Mode (IIS 6 Only)
- 12.2.9. Creating a Virtual Directory Under IIS
- 12.2.10. Adding the ISAPI Plug-in as an IIS Filter
- 12.2.11. Authorizing the ISAPI Plug-in as a Web Application Extension (IIS 6 Only)
- 12.2.12. Testing the Final Setup
- 12.3. Troubleshooting Tips
- 12.4. Using SSL
- 12.5. Scalable Architectures with IIS and Tomcat
- 12.6. Summary
-
13. JDBC Connectivity
- 13.1. JDBC Basics
- 13.2. JNDI Emulation and Pooling in Tomcat 6
- 13.3. Preferred Configuration: JNDI Resources
- 13.4. Alternative JDBC Configuration
-
13.5. Alternative Connection Pool Managers
- 13.5.1. About the c3p0 Pool Manager
- 13.5.2. Deploying the c3p0 Pooling Manager
- 13.5.3. Obtaining JDBC Connections Without JNDI Lookup
- 13.5.4. Testing Non-JNDI Pool Access with c3p0
- 13.5.5. Obtaining a Connection with JNDI Mapping
- 13.5.6. Testing c3p0 with Tomcat 6 JNDI-Compatible Lookup
- 13.5.7. Deploying Third-Party Pools
- 13.6. Summary
-
14. Tomcat Security
- 14.1. Verifying Tomcat Download Integrity
- 14.2. Securing the Tomcat Server Installation
- 14.3. Running Tomcat with a Special Account
- 14.4. Securing the File System
-
14.5. Securing the Java Virtual Machine
- 14.5.1. Overview of the Security Manager
- 14.5.2. Using the Security Manager with Tomcat
-
14.5.3. Recommended Security Manager Practices
- 14.5.3.1. Using the Security Manager
- 14.5.3.2. Understanding Application Requirements
- 14.5.3.3. Enabling Creation of a Class Loader
- 14.5.3.4. Enabling JDBC Drivers to Open Socket Connections to Databases
- 14.5.3.5. Sending E-Mail with JavaMail
- 14.5.3.6. Reading or Writing to Files Outside of the Web Application's Directory
- 14.6. Securing Web Applications
- 14.7. Encryption with SSL
- 14.8. Securing DefaultServlet
- 14.9. Host Restriction
- 14.10. Summary
-
15. Shared Tomcat Hosting
- 15.1. Virtual Hosting Concepts
- 15.2. Virtual Hosting in Apache
- 15.3. Virtual Hosting in Tomcat
- 15.4. The Tomcat Host-Manager Application
- 15.5. Virtual Hosting Issues: Stability, Security, and Performance
- 15.6. Tuning Virtual Hosting Settings in Tomcat
- 15.7. Summary
-
16. Monitoring and Managing Tomcat with JMX
- 16.1. The Requirement to Be Manageable
- 16.2. All About JMX
- 16.3. JMX Remote API
- 16.4. An Anthology of MBeans
- 16.5. JMX Manageable Elements in Tomcat 6
- 16.6. Accessing Tomcat 6's JMX Support via the Manager Proxy
- 16.7. Summary
-
17. Clustering
- 17.1. Clustering Benefits
- 17.2. Clustering Basics
- 17.3. Tomcat 6 Clustering Model
-
17.4. Working with Tomcat 6 Clustering
- 17.4.1. Session Management in Tomcat 6
- 17.4.2. The Role of Cookies and Modern Browsers
-
17.4.3. Configuring a Tomcat 6 Cluster
- 17.4.3.1. Setting Up Multiple Tomcat Instances on One Machine
- 17.4.3.2. Shutting Down the Tomcat Cluster
- 17.4.3.3. Configuring Minimal Web Applications
- 17.4.3.4. Disabling the HTTP Connectors
- 17.4.3.5. Configuring AJP TCP Ports for Clustered Tomcat Instances
- 17.4.3.6. Setting Up jvmRoute for Each Tomcat Instance to Support mod_jk
- 17.4.3.7. Setting the <distributable> Attribute for Web Applications
- 17.4.3.8. Configuration Consistency
- 17.4.4. Common Front End: Load Balancing via Apache mod_jk
- 17.4.5. Preparation for Using Different Session-Sharing Backends
-
17.4.6. Backend 1: In-Memory Replication Configuration
- 17.4.6.1. Operation of the Tomcat 6 SimpleTcpCluster
-
17.4.6.2. Cluster Session Manager Configuration with the <Cluster> Element
- 17.4.6.2.1. Binding to a Specific Adapter on Multi-Homed Machines
- 17.4.6.2.2. Configuring the <Cluster> Element
- 17.4.6.2.3. Configuring DeltaManager or BackupManager
- 17.4.6.2.4. Configuring Apache Tribes Communications Framework
- 17.4.6.2.5. Configuring the <Membership> Subelement
- 17.4.6.2.6. Configuring <Receiver> and <Sender> Subelements
- 17.4.6.2.7. Configuring <Interceptor> Subelements
- 17.4.6.3. A Replication <Valve> Element
- 17.4.6.4. The JvmRouteBinderValve
- 17.4.6.5. The Farm Deployer
- 17.4.6.6. The Cluster Listeners
- 17.4.6.7. Setting Up the Test JSP for Tomcat Session Replication
- 17.4.6.8. Testing Tomcat 6's In-Memory Session Replication Cluster
- 17.4.6.9. Observing HA Fail-Over
- 17.4.6.10. Observing Load Balancing for Requests
- 17.4.7. Backend 2: Persistent Session Manager with a Shared File Store
- 17.4.8. Backend 3: Persistent Session Manager with a JDBC Store
- 17.4.9. Testing a Tomcat Cluster with JDBC Persistent Session Manager Backend
- 17.5. The Complexity of Clustering
- 17.6. Summary
- 18. Embedded Tomcat
-
19. Logging
- 19.1. Changes from Tomcat 5
-
19.2. log4j
- 19.2.1. log4j Architecture
- 19.2.2. log4j Installation and Configuration
- 19.2.3. A Tutorial Introduction to log4j
-
19.2.4. More log4j Recipes
- 19.2.4.1. Logging from a Web Application
- 19.2.4.2. Logging to the Console
- 19.2.4.3. Logging to a File
- 19.2.4.4. Logging to Multiple Destinations
- 19.2.4.5. Rolling Log Files by Size
- 19.2.4.6. Rolling Log File by Date
- 19.2.4.7. Separating Log Messages by Level
- 19.2.4.8. Enabling Logging for Specific Packages or Classes in the Application
- 19.2.4.9. Custom Formatting of Log Messages
- 19.2.4.10. Logging Messages as HTML
- 19.2.4.11. E-mail Log Messages
- 19.2.4.12. Logging to the NT Event Log
- 19.2.4.13. Adding Additional Context Information Using Nested Diagnostic Context
- 19.2.4.14. View or Query Log Files
- 19.2.5. log4j Performance Tips
- 19.3. JULI
- 19.4. Log Files Analysis
- 19.5. Summary
-
20. Performance Testing
- 20.1. Performance Concepts
-
20.2. JMeter
- 20.2.1. Installing and Running JMeter
- 20.2.2. Making and Understanding Test Plans with JMeter
-
20.2.3. JMeter Features
- 20.2.3.1. Timer
- 20.2.3.2. Listener
-
20.2.3.3. Logic Controller
- 20.2.3.3.1. Interleave Controller
- 20.2.3.3.2. Switch Controller
- 20.2.3.3.3. Simple Controller
- 20.2.3.3.4. Loop Controller
- 20.2.3.3.5. If Controller
- 20.2.3.3.6. While Controller
- 20.2.3.3.7. Module Controller
- 20.2.3.3.8. Once Only Controller
- 20.2.3.3.9. Random Controller
- 20.2.3.3.10. Throughput Controller
- 20.2.3.3.11. Recording Controller
- 20.2.3.4. Sampler
- 20.2.3.5. Config Elements
- 20.2.3.6. Assertions
- 20.2.3.7. HTTP Proxy Server
- 20.2.4. Distributed Load Testing
- 20.2.5. Interpreting Test Results
- 20.3. Alternatives to JMeter
- 20.4. What to Do After Performance Testing
- 20.5. Summary
-
21. Performance Tuning
- 21.1. Performance Tuning Best Practices
- 21.2. Diagnosing Tomcat Performance Issues
-
21.3. Tomcat Performance Tuning Tips
- 21.3.1. Tuning the JVM Parameters
- 21.3.2. Precompiling JSPs
- 21.3.3. Tuning Tomcat Configuration
- 21.3.4. Using Web Servers for Static Content, When Appropriate
- 21.4. Summary
- A. Tomcat and IDEs
-
B. Apache Ant
- B.1. Installing Ant
- B.2. Introduction to Ant
- B.3. Ant Recipes
- B.4. Continuous Integration
- B.5. Ant Task Reference
- B.6. Summary
Product information
- Title: Professional Apache Tomcat 6
- Author(s):
- Release date: August 2007
- Publisher(s): Wrox
- ISBN: 9780471753612
You might also like
book
Apache Tomcat 7
Apache Tomcat is the most popular open-source de-facto Java Web application server, standard for today's Web …
book
Apache Tomcat 7 Essentials
This book takes you from beginner to expert in logical stages, covering all the essentials of …
book
Tomcat: The Definitive Guide
Jakarta Tomcat is not only the most commonly used open source servlet engine today, it's become …
book
Tomcat: The Definitive Guide, 2nd Edition
It takes a book as versatile as its subject to cover Apache Tomcat, the popular open …