Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Apache Tomcat 7 Essentials
Apache Tomcat 7 Essentials

Apache Tomcat 7 Essentials: This book takes you from beginner to expert in logical stages, covering all the essentials of Tomcat 7 from trouble-free installation to building your own middleware servers. Packed with examples and illustrations.

eBook
$9.99 $25.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Apache Tomcat 7 Essentials

Chapter 1. Installation of Tomcat 7

Apache Tomcat is an open source Java-based web and servlet container, which is used to host Java-based applications. It was first developed for Jakarta Tomcat. Due to an increase in demand, it was later hosted as a separate project called Apache Tomcat, which is supported by The Apache Software Foundation. It was initially developed by James Duncan Davidson, a software architect at Sun Microsystems. He later helped make this project open source and played a key role in donating this project from Sun Microsystems to The Apache Software Foundation. Tomcat implements the Java Servlet and the JavaServer Pages (JSP) specifications from Sun Microsystems, and provides a "pure Java" HTTP web server environment for Java code to run.

Apache Tomcat version 7.0 implements the Servlet 3.0 and Java Server Pages 2.2 specifications from the Java Community Process. It includes many additional features that makes it a useful platform for developing and deploying web applications and web services.

In this chapter, we will discuss the following topics:

  • Introduction to Tomcat 7

  • Features of Tomcat 7

  • Installation of Tomcat

    • Prerequisites for Tomcat 7 installation

    • Installation on Linux and Windows operating systems

  • Common areas of troubleshooting during installation

History of Tomcat

Tomcat was first introduced to the open source group in 1999 and its first version was released with 3.0.x version. Since then, it has been greatly supported by the open source community and widely accepted in the IT industry. In the current scenario, Tomcat is running in production environments, as well as being used for mission-critical projects in various industries. The following mentioned details give us a quick history of the versions.

Over the 12 years of of its successful journey, Tomcat has reached various states and given the IT industry various releases. Tomcat road maps outlined with their stable releases are mentioned as follows:

Version

Release Date

Description

3.0.x. (initial release)

1999

Merger of donated Sun Java Web Server code and ASF, and implements Servlet 2.2 and JSP 1.1 specifications.

3.3.2

March 9, 2004

Latest 3.x release.

4.1.40

June 25, 2009

Latest 4.x release.

5.5.32

February 1, 2011

Latest 5.x release.

6.0.32

February 3, 2011

Latest 6.x release.

7.0.0 beta

June 29, 2010

First Apache Tomcat release to support Servlet 3.0, JSP 2.2, and EL 2.2 specifications.

7.0.11

March 11, 2011

Fourth stable version.

7.0.12

April 6, 2011

Current stable version.

Note

For more information on version changes, release, and comparison, visit http://en.wikipedia.org/wiki/Apache_Tomcat and http://wiki.apache.org/tomcat/FrontPage.

Tomcat support matrix

Apache Tomcat can be classified based on different components, such as the JDK version, enhancement, stability, and so on. Let's take a real time example, where you want to take a decision on which Apache Tomcat version to deploy for an application. For example, if an application is using Servlet 2.4 and JSP 2.0, then we should always go for the 5.x version. In reality, it's a difficult job to find out which version of Tomcat we should use to utilize the system resource properly.

Normally, these tasks would be done by the company's technical architect, and they are solely responsible for the technical specifications used in any product. Based on the features of Tomcat, let us quickly go through the comparison of Tomcat with different versions:

Features

7.x

6.x

5.x

4.x

3.x

Version specifications

Servlet 3.0, JSP 2.2, EL 2.2

Servlet 2.5, JSP 2.1

Servlet 2.4, JSP 2.0

Servlet 2.3, JSP 1.2

Servlet 2.2, JSP 1.1

Stable:

Yes

Yes

Yes

Yes

Yes

Enhancements

Yes

Yes

Unlikely

Highly unlikely

Highly unlikely

Bug Fixes

Yes

Yes

Yes

Highly unlikely

Highly unlikely

Security Fixes

Yes

Yes

Yes

Highly unlikely

Highly unlikely

Releases

Yes

Yes

Yes

Highly unlikely

Highly unlikely

Release Manager

Mark Thomas (markt)

Jean-Frederic Clere (jfclere)

Filip Hanik (fhanik)

Mark Thomas (markt)

Bill Barker (billbarker)

Process

CTR

RTC

RTC

CTR

CTR

Listed on download pages

Yes

Yes

Yes

No

No

JDK version

1.6

1.5

1.4

1.3

1.1

In the previous table, highly unlikely means that the user using the previous version necessarily needs to have the upgraded higher version to support the new improved features. It also involves security fixes for the current version.

Features and enhancements of Apache Tomcat 7

In the previous section, we discussed the various support matrices for Tomcat versions, we are now aware of the support specifications (JDK support, EJB, and Servlet) for Tomcat. Let's try to understand, and quickly review the new features/enhancements for Tomcat 7.

Apache Tomcat 7.x was released with some key improvements over Tomcat 6.x and real time implementation of Servlet 3.0, JSP 2.2, and EL 2.2 specifications. Apart from these, it also solves some major issues from previous releases.

Web application memory leak detection and prevention

Tomcat had a chronological problem of memory leaks in 4.x/5.x versions. While reloading the applications in the entire life cycle of Tomcat, OutOfMemoryError exceptions were generated. Tomcat has put an exceptional effort in tracking down the bugs and issues related to memory, in order to avoid memory leaks.

Servlet 3.0

Tomcat 7 offers great support for Servlet 3.0. Servlet 3.0 helps developers to code very easily and also provides significant support for asynchronous programming techniques. The types of support provided are:

  • Asynchronous Support: Servlet 3.0's asynchronous support has been fully integrated into Tomcat 7. The biggest advantage of asynchronous programming is that the server doesn't have to wait for the response from the resources. For example, if you have 2000 concurrent users using an application, then we cannot allocate 2000 connections to the database and make the connection idle untill we get the response. By using asynchronous programming, your application can handle other user requests while this particular user is waiting for the response from the resources, such as DB, NAS, and so on.

  • Dynamic Configuration: It is again, a very vital feature of Servlet 3.0. 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. This means, you can integrate the library reference in web.xml.

  • Annotation-based Configuration: With the additional support for Servlet 3.0 in Tomcat 7, developers can include decorative programming styles. The biggest advantage of implementing decorator is you can configure rewrite rules in the application servlet classes instead of web servers. Hence, you reduce the dependency on web servers. It also eliminates the need for deployment descriptors.

Improved logging

Tomcat 7 includes two new features for logging, in order to provide a good understanding to the users for log analysis:

  • Asynchronous file handler: The asynchronous handler allows Tomcat to write logs to the disk by a dedicated thread, so that logging operations do not cause any delay in processing threads.

  • Single line log formatter: The single line formatter writes logs in a single line, which is a better feature for administrators.

Aliases

This is the best feature for an administrator. It provides the administrator with the freedom to eliminate the dependency of another web server to host multiple websites. In addition to this, you can host the entire static content (image/JavaScript in a single package).

Note

Important points to remember about Tomcat 7 features

Apache Tomcat 7 can be run through JRE 1.6 or later. It means that we don't have to install the complete Java Development Kit (JDK). This will be really helpful in space crunch issues and the slimming of Java will utilize less memory. But, it is also recommended from the administrator's point of view, to install the complete Java Development Kit as it provides other utilities (jmap, jstack) which are very helpful to administrators. This has an inbuilt eclipse JIT (Just in Time) compiler.

Apache Tomcat 7 resolves class loading conflict issues, such as ClassCastExceptions. ClassCastExceptions mean that there is an issue with class while loading in runtime.

History of Tomcat


Tomcat was first introduced to the open source group in 1999 and its first version was released with 3.0.x version. Since then, it has been greatly supported by the open source community and widely accepted in the IT industry. In the current scenario, Tomcat is running in production environments, as well as being used for mission-critical projects in various industries. The following mentioned details give us a quick history of the versions.

Over the 12 years of of its successful journey, Tomcat has reached various states and given the IT industry various releases. Tomcat road maps outlined with their stable releases are mentioned as follows:

Version

Release Date

Description

3.0.x. (initial release)

1999

Merger of donated Sun Java Web Server code and ASF, and implements Servlet 2.2 and JSP 1.1 specifications.

3.3.2

March 9, 2004

Latest 3.x release.

4.1.40

June 25, 2009

Latest 4.x release.

5.5.32

February 1, 2011

Latest 5.x release.

6.0.32

February 3, 2011

Latest 6.x release.

7.0.0 beta

June 29, 2010

First Apache Tomcat release to support Servlet 3.0, JSP 2.2, and EL 2.2 specifications.

7.0.11

March 11, 2011

Fourth stable version.

7.0.12

April 6, 2011

Current stable version.

Note

For more information on version changes, release, and comparison, visit http://en.wikipedia.org/wiki/Apache_Tomcat and http://wiki.apache.org/tomcat/FrontPage.

Tomcat support matrix

Apache Tomcat can be classified based on different components, such as the JDK version, enhancement, stability, and so on. Let's take a real time example, where you want to take a decision on which Apache Tomcat version to deploy for an application. For example, if an application is using Servlet 2.4 and JSP 2.0, then we should always go for the 5.x version. In reality, it's a difficult job to find out which version of Tomcat we should use to utilize the system resource properly.

Normally, these tasks would be done by the company's technical architect, and they are solely responsible for the technical specifications used in any product. Based on the features of Tomcat, let us quickly go through the comparison of Tomcat with different versions:

Features

7.x

6.x

5.x

4.x

3.x

Version specifications

Servlet 3.0, JSP 2.2, EL 2.2

Servlet 2.5, JSP 2.1

Servlet 2.4, JSP 2.0

Servlet 2.3, JSP 1.2

Servlet 2.2, JSP 1.1

Stable:

Yes

Yes

Yes

Yes

Yes

Enhancements

Yes

Yes

Unlikely

Highly unlikely

Highly unlikely

Bug Fixes

Yes

Yes

Yes

Highly unlikely

Highly unlikely

Security Fixes

Yes

Yes

Yes

Highly unlikely

Highly unlikely

Releases

Yes

Yes

Yes

Highly unlikely

Highly unlikely

Release Manager

Mark Thomas (markt)

Jean-Frederic Clere (jfclere)

Filip Hanik (fhanik)

Mark Thomas (markt)

Bill Barker (billbarker)

Process

CTR

RTC

RTC

CTR

CTR

Listed on download pages

Yes

Yes

Yes

No

No

JDK version

1.6

1.5

1.4

1.3

1.1

In the previous table, highly unlikely means that the user using the previous version necessarily needs to have the upgraded higher version to support the new improved features. It also involves security fixes for the current version.

Features and enhancements of Apache Tomcat 7

In the previous section, we discussed the various support matrices for Tomcat versions, we are now aware of the support specifications (JDK support, EJB, and Servlet) for Tomcat. Let's try to understand, and quickly review the new features/enhancements for Tomcat 7.

Apache Tomcat 7.x was released with some key improvements over Tomcat 6.x and real time implementation of Servlet 3.0, JSP 2.2, and EL 2.2 specifications. Apart from these, it also solves some major issues from previous releases.

Web application memory leak detection and prevention

Tomcat had a chronological problem of memory leaks in 4.x/5.x versions. While reloading the applications in the entire life cycle of Tomcat, OutOfMemoryError exceptions were generated. Tomcat has put an exceptional effort in tracking down the bugs and issues related to memory, in order to avoid memory leaks.

Servlet 3.0

Tomcat 7 offers great support for Servlet 3.0. Servlet 3.0 helps developers to code very easily and also provides significant support for asynchronous programming techniques. The types of support provided are:

  • Asynchronous Support: Servlet 3.0's asynchronous support has been fully integrated into Tomcat 7. The biggest advantage of asynchronous programming is that the server doesn't have to wait for the response from the resources. For example, if you have 2000 concurrent users using an application, then we cannot allocate 2000 connections to the database and make the connection idle untill we get the response. By using asynchronous programming, your application can handle other user requests while this particular user is waiting for the response from the resources, such as DB, NAS, and so on.

  • Dynamic Configuration: It is again, a very vital feature of Servlet 3.0. 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. This means, you can integrate the library reference in web.xml.

  • Annotation-based Configuration: With the additional support for Servlet 3.0 in Tomcat 7, developers can include decorative programming styles. The biggest advantage of implementing decorator is you can configure rewrite rules in the application servlet classes instead of web servers. Hence, you reduce the dependency on web servers. It also eliminates the need for deployment descriptors.

Improved logging

Tomcat 7 includes two new features for logging, in order to provide a good understanding to the users for log analysis:

  • Asynchronous file handler: The asynchronous handler allows Tomcat to write logs to the disk by a dedicated thread, so that logging operations do not cause any delay in processing threads.

  • Single line log formatter: The single line formatter writes logs in a single line, which is a better feature for administrators.

Aliases

This is the best feature for an administrator. It provides the administrator with the freedom to eliminate the dependency of another web server to host multiple websites. In addition to this, you can host the entire static content (image/JavaScript in a single package).

Note

Important points to remember about Tomcat 7 features

Apache Tomcat 7 can be run through JRE 1.6 or later. It means that we don't have to install the complete Java Development Kit (JDK). This will be really helpful in space crunch issues and the slimming of Java will utilize less memory. But, it is also recommended from the administrator's point of view, to install the complete Java Development Kit as it provides other utilities (jmap, jstack) which are very helpful to administrators. This has an inbuilt eclipse JIT (Just in Time) compiler.

Apache Tomcat 7 resolves class loading conflict issues, such as ClassCastExceptions. ClassCastExceptions mean that there is an issue with class while loading in runtime.

Installation of Tomcat 7


In the previous section, we have discussed the new enhancements in Apache Tomcat 7. Now, it's time to move on to the Tomcat installation.

How to download the Tomcat software

Perform the following steps to download the software:

  • Before we start the installation of Apache Tomcat 7 software, the first thing that comes to mind is where can you download the software from and also how much does the license cost? By default, Apache comes with Apache License, Version 2.0 ,which is compatible to GPL (General Public License). In simple terms, it is free of cost! For more information on licenses, you can visit http://www.apache.org/licenses/. Now, the second problem is how to download the software.

  • It is always recommended to download the software from its official site, http://tomcat.apache.org/download-70.cgi. By default, on http://tomcat.apache.org/, we get the latest stable version of Tomcat package and we have to download the package based on the operating system, where we want to install it.

Once the download is complete, then you have to do the integrity check for the downloaded software using the MD5 checksum.

Note

MD5 Message-Digest Algorithm is a widely used cryptographic hash function that produces a 128-bit (16 byte) hash value.

Following is the process to perform the integrity check using the MD5 checksum:

  1. 1. Download the MD5 checksum from the website apache.org. The MD5 check sum is integrated with every package we download. 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.

  2. 2. Run the following command to generate the checksum for the downloaded software. See the following screenshot:

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

Tomcat comes with different packages for installation such as binary, source, and RPM. Based on the requirement, the package should be taken from the official site. Let's have a brief discussion on which package should be implemented in real time and why.

Binary package

It comes with a pre-set library and customized configuration which are implemented and tested as per industry standards. A few advantages of using the binary package are:

  • It is a standard package that suits most of the real-time environments

  • In a non-DOS environment (such as Linux, UNIX, and so on), we can configure multiple Tomcat instances on a single OS

  • It is path independent; we can configure Tomcat in any part of the OS based on our resources available (hardware)

RPM/exe

RPM is defined as a system installer, which is developed and compiled on each OS independently. It has a pre-defined library, which will work only on the respective OS. A few advantages of using RPM are:

  • It does not require installation of any dependent libraries for the package

  • RPM is built with the shared libraries for the respective OS

  • It does not need to configure separate startup services

The only disadvantage is, we cannot configure multiple instances in a single operating system and it has predefined paths.

Source

You can customize the installation based on your requirements using the source package. Suppose you want to customize during installation of the software, it can be done in this package.

  • Customization of Tomcat can be done very effectively (only required services are installed)

  • In a non-DOS environment (such as Linux, UNIX, and so on), we can configure multiple Tomcat instances on a single OS

  • It is path independent; we can configure Tomcat in any part of the OS based on our resources available (hardware)

  • In a production environment, it's always recommended to use the source or binary instead of the RPM

Prerequisites for the Tomcat 7 installation

Before we begin with the Apache Tomcat 7 installation, we have to configure the prerequisites and they are very important for the Tomcat 7 installation to start. Following are the prerequisites mentioned for Apache Tomcat 7:

  • Java SE 1.6 or later

  • Configuration of the OS environment variables

Installation of Java

Java has been developed by many vendors. Based on the application requirement and type of architecture, different JVMs are used by various applications. Common JDK vendors are IBM, HP, Sun, OpenJDK, and so on. Sun holds a major stake in IT industries. JDK is widely used and accepted across various IT industries.

JDK packages are available for each OS and can be compiled on any system using a common set of libraries. These packages are easily available on the Internet or already integrated with different OS vendors.

JDK/JRE comes in 32 bit and 64 bit editions, so we can use it based on the application requirement. Some of the performance characteristics of the 64 bit versus 32 bit Virtual Machine (VM) are:

  • The benefits of using 64 bit are being able to address larger amounts of memory which comes with a small performance loss in 64 bit VMs, versus running the same application on a 32 bit VM

  • You can allocate more than 4 GB to JVM for memory intensive applications

Note

In a 64 bit Java edition, you have to allocate more memory for JVM as compared to a 32 bit edition. In practice, a 64 bit Java requires 30 percent more memory than the 32 bit Java version.

Installation of Java in Linux

In this topic, we will discuss the steps performed during installation of Java on Linux:

  1. 1. Download the JDK from the Oracle site on the Linux system.

    Note

    For more information about the version changes and releases, visit http://www.oracle.com/technetwork/java/javase/downloads/index.html.

    We are doing the installation on the /opt partition of the hard drive and the Java version we are using is Java(TM) SE Runtime Environment (build 1.6.0_24-b07).

    • Once the download is complete, it will create the binary file in /opt (jdk-6u24-linux-i586.bin).

  2. 2. Change the permission of the package 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.

  3. 3. Run the following command to install the JDK:

    [root@localhost opt]# ./jdk-6u24-linux-i586.bin
    
    • You will see an output similar to the following screenshot:

  4. 4. During the installation, the binary will prompt for the acceptance of the agreement, then press Enter. See the following screenshot:

  5. 5. After pressing Enter it will exit from the command prompt, as shown in the following screenshot:

  6. 6. After the installation is complete, the binary will create the folder named jdk1.6.0_24 in /opt. If the folder is present in /opt, that means the installation is successfully done. See the following screenshot:

Let's quickly go through the JDK directory structure, shown in the previous screenshot:

  • bin: It contains the entire executable for the JDK for java, javac, jmap, and so on.

  • jre: It contains all the files necessary for Java to perform the function.

  • lib: As the name suggests, it's a library directory for the JDK.

  • man: This directory contains all the manual pages for Java (document directory).

  • demo:-This folder contains working examples of different utilities. These utilities can be directly used.

  • sample: This directory contains the code files for utilities provided in the demo directory.

  • include: It contains the header files for different functions used in Java.h

  • db: It contains the entire component of the Derby Database. Derby is a pure Java relational database engine.

Note

Tomcat 7 can be run on JRE, it means no need to install a JDK component; if there is a space issue in your environment that can be customized accordingly.

Installation of Java in Windows

In this topic, we will discuss the steps performed during installation of Java in the Windows operating system:

  1. 1. Download the JDK from the Oracle site on the Windows system from the following link: http://www.oracle.com/technetwork/java/javase/downloads/index.html.

    Note

    We are doing the installation on the C partition of the hard drive and the Java version we are using is Java(TM) SE Runtime Environment (build 1.6.0_24-b07).

  2. 2. Once the download is complete, jdk-6u24-windows-i586.exe is created in the download location.

  3. 3. By double-clicking the jdk-6u24-windows-i586.exe file, installation of Java will begin. It will open a new pop-up window for installation. See the following screenshot:

  4. 4. By clicking Next on the window, it will take us to a new window where we can customize the JDK installation based on the requirement, as well as define the installation path of the JDK. In the current environment, we are installing Java on the default location.

  5. 5. Check if the default path is C:\Program Files\Java\jdk1.6.0_24.

  6. 6. Check the field Installation type: Default.

  7. 7. Once the installation is done, it will show the status as complete, similar to the following screenshot:

Configuration of OS environment variables

After the installation of Java on a different OS, it's now time to set the environment variables for Tomcat at the OS level. In order to run Tomcat, we have to define the JAVA_HOME as an environment variable and set the path for Java so that it can be accessed from any partition of OS.

What is JAVA_HOME?

JAVA_HOME is the JDK install directory, for example, C:\jdk6. It is meant to be set as an environment variable and referenced in Windows batch files or Unix scripts. In Tomcat, JAVA_HOME is defined in catalina.sh under TOMCAT_HOME/bin. The following screenshot shows the definition of JAVA_HOME in Tomcat 7. Once you execute startup.sh, it internally calls catalina.sh and invokes JAVA_HOME. In a production environment, it is always recommended to use the permanent environment variable.

Setting the JAVA_HOME and PATH variable in Windows

The environment variable and path can be set in Windows by performing the following steps:

  1. 1. Right-click on the My Computer icon on your desktop and then click Properties, as shown in the following screenshot:

  2. 2. Click Advanced | Environment Variables.

  3. 3. Under System Variables, click New.

  4. 4. In the Variable name field, enter JAVA_HOME, as shown in the following screenshot:

  5. 5. In the Variable value field, enter the installation path of the Java Development Kit.

  6. 6. Click OK.

  7. 7. Click on Apply Changes.

Setting the global path variable in Windows

After setting JAVA_HOME, now it is time to add the Java path in the global path variable. Following is a detailed procedure, which needs to be followed for creating the global path variable in Windows:

  1. 1. Right-click on the My Computer icon on your desktop and then click Properties.

  2. 2. Click Advanced | Environment Variables.

  3. 3. Under System Variables, click on Path.

  4. 4. Edit the path and add the Java path in the end.

  5. 5. In the Variable value field, enter the installation path of the Java Development Kit, as shown in the previous screenshot.

  6. 6. Click OK.

  7. 7. Click on Apply Changes.

Setting the JAVA_HOME and the PATH environment variable in Linux

The environment variable and path are set differently in Linux as compared to Windows. Perform the following steps to set the environment variable in Linux:

  1. 1. Open the .bash_profile using the vi editor for the root user.

    Note

    You can put the environment variable in bashrc also. It will also execute at the time of the user login.

  2. 2. Add the following environment variable in the file. The following is the code snippet of .bash_profile. The highlighted code shows the declaration of JAVA_HOME and PATH. export will add the JAVA_HOME and PATH to the system parameter for every user login.

    # .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
    
  3. 3. Save the .bash_profile using the :wq command.

  4. 4. Once you have saved the .bash_profile, then you have to logout and re-log in to the environment to activate the changes using the following command:

    su - username
    su - root (as our user is root)
    

    Note

    If we run the previous command for any user, then the profile of that user will be reloaded.

Also, you can run the env command to verify the environment variables are configured properly, as shown in the following screenshot:

Note

It is always best practice to first take the backup of the existing profile. In case there are issues while doing the changes, then we can revert back the changes using the command cp

[root@localhost ~]# cp .bash_profile .bash_profile_backup.

Now we have set the environment variable for Windows and Linux environments, but how can we verify whether the environment is set properly or not?

Before we start installation of Apache Tomcat 7, let's quickly verify the environment variable on both the OSes.

In the Windows environment, variables can be verified using the following command:

echo %VARIABLE_NAME%

For JAVA_HOME:

C:\Users\user>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_24

For PATH:

C:\Users\user>echo %PATH%
C:\Program Files\PC Connectivity Solution\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\ Program Files\Broadcom\Broadcom 802.11\Driver;
C:\Program Files\Java\jdk1.6.0_24\bin

In Linux, we can use the following command to verify the environment variables:

echo $VARIABLE_NAME

For JAVA_HOME:

[root@localhost ~]# echo $JAVA_HOME
/opt/jdk1.6.0_24

For PATH:

[root@localhost ~]# echo $PATH
/opt/jdk1.6.0_24/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/ sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

After verifying the environment variable on both the OSes, we are sure that JAVA_HOME and PATH are properly set in the environment. We have completed the prerequisites of installation of Apache Tomcat 7. Now, we can proceed with the installation of Apache Tomcat 7.

Installation of Apache Tomcat 7

Let's start the installation of Tomcat 7 on different OSes. The steps involved to install the software on Windows are discussed first, and then we move on to the Linux environment.

Installation on a Windows environment

In this topic, we will discuss the steps involved during the software installation of Tomcat 7. Following are the steps:

  1. 1. Download the latest stable version from the Tomcat official site, http://tomcat.apache.org/download-70.cgi. We are downloading the 32-bit/64-bit Windows Service Installer (pgp, md5). Once the download is complete, save it in the software folder.

  2. 2. Double-click on apache-tomcat-7.0.14.exe. It will launch the setup wizard.

    Note

    If you don't find the exe file along with the downloaded folder, download it using the link, http://apache.osuosl.org/tomcat/tomcat-7/v7.0.23/bin/. Save the file in the apache-tomcat folder.

  3. 3. Then, click on Next button to continue, as shown in the following screenshot:

  4. 4. An agreement pop-up is displayed. Click on I Agree. It means we agree to use Tomcat 7 as per the GPL license, as shown in the following screenshot:

  5. 5. The following window shows us the different components we need to install:

  6. 6. In the next step, we have to configure the username and password for the Tomcat Manager, as shown in the following screenshot. We have set the Username and Password to admin. Click on Next.

  7. 7. In the next window, it will pick up the Java version from the JAVA_HOME variable, if the variables are properly defined, as shown in the following screenshot:

  8. 8. The next window displays the installation path of Tomcat. By default, we use C:\Program Files\Apache Software Foundation\Tomcat 7.0. In case we want to change it, then we have to click on Browse and select the desired path. Click on Install, as shown in the following screenshot:

  9. 9. It's the final step of the Tomcat 7 installation. This will display the successful implementation of Tomcat, as shown in the following screenshot:

Installation on a Linux environment

Installation of Tomcat 7 is quite simple in a Linux environment as compared to Windows. It can be done in just three steps:

  1. 1. Download the latest stable version from Tomcat's official site http://tomcat.apache.org/download-70.cgi. Once the download is complete, save it in the /opt location. Unzip the Tomcat 7 source, that is, apache-tomcat-7.0.12.zip using the following command:

    [root@localhost opt]# unzip apache-tomcat-7.0.12.zip
    
  2. 2. After you unzip the apache-tomcat-7.0.12.zip, it will create the directory named apache-tomcat-7.0.12 in the opt directory. Go to the bin directories of apache-tomcat-7.0.12 using the following command:

    [root@localhost opt]# cd apache-tomcat-7.0.12/bin/
    
  3. 3. Run the following command. If you fail to run the following command, then Tomcat services will not come up. By default, the package comes with read/write permissions, but no execution permissions are given to the package. We have to manually change the permissions:

    [root@localhost bin]# chmod 0755 *.sh
    [root@localhost bin]# pwd
    /opt/apache-tomcat-7.0.12/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.

After this step, the installation of Tomcat is complete in Linux.

Startup and shutdown of Tomcat services

We have now completed the installation of Apache Tomcat on both the OSes. Now, it's time to start the services and verify the setup we have created up to now. So why waste time, let's rock and roll.

Services in Windows

In Windows, we can start/stop the services using two methods:

  • Through the Microsoft Management Console (MMC): Go to Start | Run | services.msc. When the MMC opens, as shown in the following screenshot, you can start/stop services based on the requirement:

  • Apache monitor console: Tomcat comes with a very handy tool for administration, which is popularly known as the Apache monitoring console. It's very useful in managing the Tomcat instance (service recycle, enabling logs, and JVM configuration).The following screenshot shows the recycle process using the Tomcat monitoring console. To start/stop services, go to Start | Programs | Apache-Tomcat7 |apache-tomcat monitor Start/Stop.

Services in Linux

The Linux startup process is completely different. Here, we have to run the startup/shutdown scripts manually to bring the services online. Let us start the services on Linux to verify the installation.

Before that, let's quickly verify the configuration. Tomcat 7 comes with different scripts, through which we will verify the complete installation. There is a very good script placed in the Tomcat bin directory named as version.sh, through which we can verify the complete Tomcat version and system information. Let's run the script using the following command:

[root@localhost bin]# ./version.sh
Using CATALINA_BASE: /opt/apache-tomcat-7.0.12
Using CATALINA_HOME: /opt/apache-tomcat-7.0.12
Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.12/temp
Using JRE_HOME: /opt/jdk1.6.0_24
Using CLASSPATH: /opt/apache-tomcat-7.0.12/bin/bootstrap.jar:/opt/apache-tomcat-7.0.12/bin/tomcat-juli.jar
Server version: Apache Tomcat/7.0.12
Server built: Apr 1 2011 06:13:02
Server number: 7.0.12.0
OS Name: Linux
OS Version: 2.6.18-8.el5
Architecture: i386
JVM Version: 1.6.0_24-b07
JVM Vendor: Sun Microsystems Inc.

There is one more script in the Tomcat bin directory that is very useful. configtest.sh is used to check any configuration changes in scripts. This script performs a quick configuration check on the system and finds the errors. Let's run the script using the following command:

[root@localhost bin]# ./configtest.sh
Using CATALINA_BASE: /opt/apache-tomcat-7.0.12
Using CATALINA_HOME: /opt/apache-tomcat-7.0.12
Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.12/temp
Using JRE_HOME: /opt/jdk1.6.0_24
Using CLASSPATH: /opt/apache-tomcat-7.0.12/bin/bootstrap.jar:/opt/apache-tomcat-7.0.12/bin/tomcat-juli.jar
May 22, 2011 4:06:16 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
May 22, 2011 4:06:16 PM org.apache.coyote.AbstractProtocolHandler init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
May 22, 2011 4:06:16 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1401 ms

Note

configtest.sh is available in a Linux environment only.

After doing the configuration check, start the Tomcat services. The Tomcat services can be started using the startup.sh in the bin directory.

Startup script

To start the Tomcat services, you have to perform the following mentioned steps:

  1. 1. The first step is to change the directory from the current location to the Tomcat directory.

    [root@localhost bin]# cd /opt/apache-tomcat-7.0.12/bin/
    
  2. 2. In the bin directory, we will find the entire executable for Tomcat. To start the services, we have to use the following command. Once you execute the startup command, it will display the parameters which are essential for booting Tomcat. Some of them are CATALINA_BASE, CATALINA_HOME, JRE_HOME, and so on.

    [root@localhost bin]# ./startup.sh
    Using CATALINA_BASE: /opt/apache-tomcat-7.0.12
    Using CATALINA_HOME: /opt/apache-tomcat-7.0.12
    Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.12/temp
    Using JRE_HOME: /opt/jdk1.6.0_24
    Using CLASSPATH: /opt/apache-tomcat- 7.0.12/bin/bootstrap.jar:/opt/apache-tomcat-7.0.12/bin/ tomcat-juli.jar
    

Shutdown script

A Tomcat shutdown script is also available in the bin directory named as ./shutdown.sh. Let's execute the script to know the output. The details are as follows:

[root@localhost bin]# cd /opt/apache-tomcat-7.0.12/bin/
[root@localhost bin]# ./shutdown.sh
Using CATALINA_BASE: /opt/apache-tomcat-7.0.12
Using CATALINA_HOME: /opt/apache-tomcat-7.0.12
Using CATALINA_TMPDIR: /opt/apache-tomcat-7.0.12/temp
Using JRE_HOME: /opt/jdk1.6.0_24
Using CLASSPATH: /opt/apache-tomcat- 7.0.12/bin/bootstrap.jar:/opt/apache-tomcat-7.0.12/bin/tomcat-juli.jar

Verification of Tomcat status

Once we have executed the startup scripts, the next step is the verification of the Tomcat services, to check whether services are coming up fine or not. By default, Tomcat runs on HTTP port 8080 and can be accessed on the web browser using the URL, http://localhost:8080. We then find the Tomcat welcome page, which shows that Tomcat is installed correctly and running fine in the environment, as shown in the following screenshot:

Once the welcome page for Tomcat 7 is displayed, we can verify the server status by clicking on Server Status.

It will prompt for the user ID/password. Remember, we have created a user admin that the user ID will be used here for access, as shown in the following screenshot:

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.

Summary


In this chapter, we have covered the Apache Tomcat history and new features introduced in Tomcat 7. We have done a step-by-step installation of Tomcat on Windows and Linux operating systems. Also, we have discussed the common problems that may arise during the installation and their possible solutions.

In the next chapter, we will discuss the various methods used for deployment in Tomcat 7 and solution of issues that may occur during the deployment process.

Left arrow icon Right arrow icon

Key benefits

  • Readymade solution for web technologies for migration/hosting and supporting environment for Tomcat 7
  • Tips, tricks, and best practices for web hosting solution providers for Tomcat 7
  • Content designed with practical approach and plenty of illustrations

Description

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.

Who is this book for?

If you are a J2EE administrator, migration administrator, technical architect, or a project manager for a web hosting domain, and are interested in Apache Tomcat 7, then this book is for you. If you are someone responsible for installation, configuration, and management of Tomcat 7, then too, this book will be of help to you.

What you will learn

  • Learn to install Tomcat 7 on Windows/Linux step-by-step and resolve any issues faced during installation
  • Deploy multiple applications and troubleshoot any issues that occur during deployment
  • Implement best practices in the production environment and learn tricks to reduce your day to day work load
  • Dig deep into high availability architecture configuration (load balancing and clustering configuration) using front end web server like Apache and IIS
  • Become an expert in tuning the Tomcat for performance
  • Upgrade to Tomcat 7 successfully from the previous versions
  • Configure Tomcat for Dev/QA/stage/production environment and indulge into maintenance tips
  • Get familiar with thread dump analysis, monitoring JVM, database and OS related issues, and diagnose Tomcat 7 issues
Estimated delivery fee Deliver to Indonesia

Standard delivery 10 - 13 business days

$12.95

Premium delivery 5 - 8 business days

$45.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Mar 23, 2012
Length: 294 pages
Edition : 1st
Language : English
ISBN-13 : 9781849516624
Vendor :
Apache
Category :
Languages :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Indonesia

Standard delivery 10 - 13 business days

$12.95

Premium delivery 5 - 8 business days

$45.95
(Includes tracking information)

Product Details

Publication date : Mar 23, 2012
Length: 294 pages
Edition : 1st
Language : English
ISBN-13 : 9781849516624
Vendor :
Apache
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 92.98
Apache Tomcat 7 Essentials
$43.99
Tomcat 6 Developer's Guide
$48.99
Total $ 92.98 Stars icon
Banner background image

Table of Contents

11 Chapters
Installation of Tomcat 7 Chevron down icon Chevron up icon
Configuration and Deployment Chevron down icon Chevron up icon
Performance Tuning Chevron down icon Chevron up icon
Integration of Tomcat with the Apache Web Server Chevron down icon Chevron up icon
Securing Tomcat 7 Chevron down icon Chevron up icon
Logging in Tomcat 7 Chevron down icon Chevron up icon
Troubleshooting in Tomcat Chevron down icon Chevron up icon
Monitoring and Management of Tomcat 7 Chevron down icon Chevron up icon
Clustering in Tomcat 7 Chevron down icon Chevron up icon
Tomcat Upgrade Chevron down icon Chevron up icon
Advanced Configuration for Apache Tomcat 7 Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Half star icon Empty star icon Empty star icon 2.8
(12 Ratings)
5 star 16.7%
4 star 8.3%
3 star 25%
2 star 41.7%
1 star 8.3%
Filter icon Filter
Top Reviews

Filter reviews by




gawils25 Feb 11, 2013
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I like the book because the Author gave not just theory, but a lot of step by step practical hands on information.So the book can be used two-flod. As a book that gives you a good understanding of Tomcat 7 and a manual that guides you with step by step instructions for different implementations of Tomcat.The Book addresses 5 main areas that were well covered.Tomcat installation on Linux and Windows, configuration, Web server setup, Security, and trouble-shooting issues.
Amazon Verified review Amazon
Jonas Okwara Dec 31, 2012
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I just Love The step by step approach of this book. Bought the Kindle edition and how convenient that had been for me
Amazon Verified review Amazon
Robert Alan Ward Jun 05, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
I like this book and it is already providing good value as a reference. I am not reading it cover to cover but as items come up in daily work it has helped several times already in the past month.
Amazon Verified review Amazon
Deepanshu Sarawagi Oct 31, 2016
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
This isn't a great book to learn Tomcat at professional level. Doesn't explain about Tomcat's architecture which is the most important chapter. Although, can be recommended for beginners.
Amazon Verified review Amazon
Chris Mar 09, 2013
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Not a bad book but I didnt love it either. At times it was hard to follow and a bit wordy for me personally.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela