Book Image

Apache Tomcat 7 Essentials

By : Tanuj Khare
2 (1)
Book Image

Apache Tomcat 7 Essentials

2 (1)
By: Tanuj Khare

Overview of this book

Apache Tomcat (or simply Tomcat) is an open source servlet container developed by the Apache Software Foundation (ASF). The latest major stable release, Apache Tomcat version 7 implements the Servlet 3 and JavaServer Pages 2 specifications from the Java Community Process, and includes many additional features that make it a useful platform for developing and deploying web applications and web services.Apache Tomcat 7 Essentials follows a practical approach to teach installing, configuring, and maintaining Tomcat. It helps you to understand the middle architecture for hosting multiple websites and also provides the confidence to implement middleware support. It imparts to you the capacity to resolve migration issues and also provides regular maintenance solutions. This is the first and only book to cover upgrading to Tomcat 7 from previous versions.The journey of the reader starts at the beginner level and ends at the expert level. The content is designed in such a way that it balances the theory and practical approach for understanding concepts related to handling middle ware and web issues.In this book, you will go through a three-phase life cycle. The first cycle consists of installation, configuration of Tomcat 7 on different OS, and other configurations related to JDBC, port, deployment etc. The second phase deals with the building of enterprise application setup and high availability architecture (clustering load balancing). The third and critical phase will teach you to handle critical issues, performance tuning, and best practices for various environment stacks like dev/QA/stage/production.This book gives you a wider vision of using Tomcat 7 in web technologies and the skill to optimize their performance using Apache Tomcat 7.
Table of Contents (18 chapters)
Apache Tomcat 7 Essentials
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface

Preface

This book will help you resolve these issues and boost your confidence in handling Apache Tomcat 7 administration using the tips, tricks, and best practices used by various industry experts to maintain their middleware infrastructure. The best thing that the author did while designing the content is a practical solution, with a detailed description of why we are doing this solution.

Apache Tomcat (or Jakarta Tomcat, or simply Tomcat) is an open source servlet container developed by The Apache Software Foundation. The latest major stable release, Apache Tomcat version 7, implements the Servlet 3 and JavaServer Pages 2 specifications from the Java Community Process. It includes many additional features that make it a useful platform for developing and deploying web applications and web services.

Apache Tomcat 7 Essentials follows a practical approach to explain installing, configuring, and maintaining Tomcat. It helps you to understand the middleware architecture to host multiple websites and also provides the confidence to implement middleware support. It imparts to you the capacity to resolve migration issues and also provides regular maintenance solutions. This is the first, and only, book to cover upgrading to Tomcat 7 from the previous versions.

The journey of the reader starts at the beginner's level and ends at the expert level. The content is designed in such a way that it balances the theory and practical approach for understanding concepts related to handling middleware and web issues.

In this book, you will go through a three-phase life cycle. The first cycle consists of the installation, configuration of Tomcat 7 on different OSes, other configurations related to the JDBC, port, deployment, and so on.

The second phase deals with the building of an enterprise application setup and high availability architectures (clustering and load balancing). The third and critical phase will teach you to handle critical issues, performance tuning, and the best practices for various environments such as Dev/QA/Stage/Production.

This book gives you a wider vision of using Tomcat 7 in web technologies and the skill to optimize its performance using Apache Tomcat 7.

What this book covers

Chapter 1, Installation of Tomcat, covers the Apache Tomcat history and the new features introduced in Tomcat 7. The step-by-step installation of Tomcat 7 on Windows and Linux operating systems and common problems that may arise during the installation and their possible solutions are also discussed.

Chapter 2, Configuration and Deployment, covers the configuration of Tomcat including the DataSource configuration for different databases such as Oracle, MySQL, and PostgreSQL, and Context Path creation using an application. Various ways to perform deployment including deployment using Tomcat Manager for a sample application and troubleshooting common issues are also discussed.

Chapter 3, Performance Tuning, explains the different ways of performance improvement and techniques in Apache Tomcat 7. Step-by-step configurations for Connectors, JVM performance tuning, and OS parameter optimization are also covered.

Chapter 4, Integration of Tomcat with the Apache Web Server, explains the integration of Apache/IIS with Tomcat 7, integration of various components such as mod_jk, mod_proxy, and real-time issues which may arise during integration, along with their solutions.

Chapter 5, Securing Tomcat 7, explains the various policies of Tomcat 7 and its functionalities such as the Catalina policy and System level policy. Measures to enable security and their benefits such as SSL, best practices used in real-time industries to secure Tomcat 7 in the production environment, by doing the configuration change and SSL implementation are also covered.

Chapter 6, Logging in Tomcat 7, explains the different methods of enabling logs in Tomcat 7—log4j and JULI. Also, the best practices used for log analysis, tips, and tricks are discussed.

Chapter 7, Troubleshooting in Tomcat, covers different issues faced by the application/web administrators in a real-time environment, how to avoid these issues in the production environment using different techniques with errors and their solutions, thread dump analysis and tools used for thread dump analysis, memory issues, steps for troubleshooting real-time problems, and web server benchmarking.

Chapter 8, Monitoring and Management of Tomcat 7, explains various processes of monitoring in Tomcat 7, components using Tomcat Manager and JConsole, such as different ways of monitoring, how monitoring is done in Tomcat 7, JConsole, and how it is used.

Chapter 9, Clustering in Tomcat 7, explains clustering of Tomcat 7 and its implementation technique. Topics included are clustering architecture, horizontal and vertical clusters and their benefits, implementation of horizontal and vertical clustering on Tomcat 7, and verification of clusters.

Chapter 10, Tomcat Upgrade, explains various strategies used in the upgrade from Tomcat 6 to Tomcat 7 and the various steps followed during the upgrade process such as the life cycle of the upgrade, upgrade configuration of Tomcat 7, DataSource configuration, and discussions on various ITIL processes used during upgrade.

Chapter 11, Advanced Configuration for Apache Tomcat 7, explains the advanced configuration of Tomcat 7 and its optimization parameters. Key points covered in the environment are virtual hosting, features of Development/QA/Stage/Production, Tomcat as a service, and running Tomcat as a non privileged user.

What you need for this book

To understand the contents of this book, you should have a basic knowledge of Windows or Linux operating systems and it is an added advantage if you have some knowledge in Java.

Who this book is for

If you are a J2EE Administrator, Migration Administrator, Technical Architect, or Project Manager for a web hosting domain, and are interested in Apache Tomcat 7, then this book is for you. If you are responsible for the installation, configuration, and management of Tomcat 7, then this book will be of help to you too.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Due to Tomcat 7's support for web fragments, developers now don't need to implement the specific library configurations for their application web.xml."

A block of code is set as follows:

# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ];then
. ~/.bashrc
fi
# User specific environment and start-up programs
JAVA_HOME=/opt/jdk1.6.0_24
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin
export PATH JAVA_HOME
unset USERNAME

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<Executor name="tomcatThreadPool
"namePrefix="catalina-exec-"
maxThreads="150"
minSpareThreads="4"/>

Any command-line input or output is written as follows:

[root@localhost opt]# cksum apache-tomcat-7.0.12.zip

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "The previous screenshot shows the packages which are available in md5, and by clicking on md5 on the website, we can compare the checksum generated in our system with the value given on the site."

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title through the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.