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

Common problems and troubleshooting in installation


There are multiple issues which may arise during the installation of Tomcat 7. Let's discuss these issues:

Error: Permission denied for the Java binary

Scenario 1: The Java installation is not working, while executing the Java binary.

[root@localhost opt]# ./jdk-6u24-linux-i586.bin
-bash: ./jdk-6u24-linux-i586.bin: Permission denied

Issue: The Java binary doesn't have execute permissions with a specific user.

Fix: Change the permission to 0755 for ./jdk-6u24-linux-i586.bin using the following command:

chmod 0755 jdk-6u24-linux-i586.bin

Note

The chmod 0755 file is equivalent to u=rwx (4+2+1),go=rx (4+1 & 4+1). The 0 specifies no special modes.

Error: Tomcat is not able to find JAVA_HOME

Scenario 2: While starting the Tomcat startup script, the following error occurs:

[root@localhost bin]# ./startup.sh
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variables is needed to run this program

Fix: Check the .bash_profile and find out whether the following mentioned entry is present in the file:

JAVA_HOME=/opt/jdk1.6.0_24
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin
export PATH JAVA_HOME

Error: Error in the logs showing port already in use

Scenario 3: Tomcat services is not displayed after running startup.sh.

Issue: This service is already running on the server.

Fix: Check for any Java process running in the system using the following command in Linux:

Ps -ef |grep tomcat

This command will show all Tomcat processes. If any process is running on an OS, kill it and run the startup scripts again.

In Windows, go to the Task Manager and check if any Java process is running for Tomcat. If any process is running, then kill the process and restart the Tomcat services.