Child pages
  • Migrate from Tomcat 5.5 to Tomcat 7
Skip to end of metadata
Go to start of metadata

Overview

Important:

EasyApache 3 does not support Tomcat for new installations. EasyApache 4 does not support Tomcat and we do not plan to provide support in the future. 

Apache Tomcat is the Java web server for Apache. This document includes information on Tomcat compatibility, and changes between Tomcat 5.5 and Tomcat 7.

For more information on Tomcat, read our Introduction to Tomcat documentation.

Versions of Tomcat

Use the following table to determine which versions of Tomcat are available for your configuration:

Version of cPanel & WHMCurrent Apache VersionCurrent Tomcat VersionYou may install
11.36 or earlierAnyNoneTomcat 5.5
11.36 or earlierAnyTomcat 5.5Tomcat 5.5
11.38.0.8 or later2.2 or laterNoneTomcat 7*
11.38.0.8 or later2.2 or laterTomcat 5.5Tomcat 7*
11.38.0.8 or later2.2 or laterTomcat 7*Tomcat 7

Warnings:

  • If you upgrade to Tomcat 7, you cannot downgrade back to Tomcat 5.5 through EasyApache.
  • Tomcat 7 will appear as an option in all releases of cPanel & WHM version 11.38, but will only install correctly for cPanel & WHM version 11.38.0.8 or later.

Note:

You cannot run Tomcat 5.5 and Tomcat 7 simultaneously.

 

Warning:

Currently, we no longer develop EasyApache 3 and only release security updates. We have tentatively scheduled EasyApache 3 for deprecation at some point in 2018. You will receive at least three months notification prior to official deprecation. After that time, EasyApache 3 will no longer receive any updates. For more information, read our cPanel Long-Term Support documentation.

We strongly recommend that you upgrade to EasyApache 4. For more information, read our EasyApache 4 documentation. 

Featured documentation

  EasyApache 3

IntroductionFAQ

Change Log Release Notes  

ProfilesCustomization

Tomcat

Migrate from Tomcat 5.5 to 7

How to Deploy Java Applications

Important:

EasyApache 3 does not support Tomcat for new installations. EasyApache 4 does not support Tomcat and we do not plan to provide support in the future. 

Differences between Tomcat 5.5 and Tomcat 7

OpenJDK 7

Tomcat uses a Java Development Kit (JDK). Tomcat 5.5 uses the Sun-implemented JDK. Tomcat 7 uses the community-developed OpenJDK 7 RPM that your operating system provides. CentOS and Red Hat® versions 5.9, 6.3, 6.4, or later include the OpenJDK 7 RPM that Tomcat 7 requires.

Warning:

If your operating system does not support the OpenJDK 7 RPM, you cannot use Tomcat 7.

For more information on OpenJDK 7, visit the OpenJDK website.

EasyApache uses RPM files to install Tomcat 7

EasyApache uses the mod_jk Apache module to install Tomcat 5.5.

Note:

We will continue to distribute the mod_jk Apache module by tarball to ensure compatibility.

EasyApache uses RPM files to install Tomcat 7. EasyApache installs the Tomcat 7 software in the /usr/local/easy directory. A Tomcat 7 installation includes the following RPM files:

  • Tomcat 7
  • JSVC
  • MySQL® Connector/J

The RPM files follow the following naming convention:

easy-<PACKAGE.VERSION.RELEASE>.rpm 

For example:

easy-tomcat7-7.0.41.0.rpm

Note:

The functionality of EasyApache does not change when it uses an RPM to install software.

Automatic updates without rebuilding EasyApache

One of the benefits to Tomcat 7 is that you can update the software without performing an EasyApache build. If you wish to update Tomcat 7 to the latest version and do not wish to rebuild EasyApache, perform the following steps:

  1. Run EasyApache in the EasyApache 3 interface (Home >> Software >> EasyApache 3)
    • The first step EasyApache performs is to update the EasyApache software, the EasyApache configuration files, and the RPM versions list.
    • For more information on EasyApache, view our EasyApache documentation.
  2. After the update is complete, EasyApache will display the Profile interface. Exit EasyApache.
    • To exit EasyApache, select any other interface in WHM.
  3. Run either the upcp script or the check_cpanel_rpms script.

Tomcat software versions

Tomcat 7 includes newer versions of the following software:

  • Servlet 3.0
  • Expression Language 2.2
  • JavaServer Pages 2.2

Your applications may require modifications before they will work in the new environments.

Tomcat 7 compiles JavaServer Pages (JSPs) with the Eclipse Compiler for Java (ecj) on Java 6. Your JSPs may require modifications to work in Tomcat 7.

Manager and admin roles

Tomcat 5.5 uses the manager and admin roles. Tomcat 7 replaces the manager and admin roles with the following roles:

Admin roles:

  • admin-gui
  • admin-script

Manager roles:

  • manager-gui
  • manager-jmx
  • manager-script
  • manager-status

Warning:

You must assign roles manually because EasyApache does not migrate the user definition database from Tomcat 5.5 to Tomcat 7. Tomcat 7 applications rely on specific permissions that are assigned to roles.

Install location

Tomcat 5.5

EasyApache installs Tomcat 5.5 in the /usr/local/jakarta/apache-tomcat-5.5.XX directory. The /usr/local/jakarta/tomcat file is a symlink to the Tomcat installation.

Tomcat 7

EasyApache installs Tomcat 7 in the /usr/local/easy/share/easy-tomcat7 directory.

If you upgrade from Tomcat 5.5 to Tomcat 7, EasyApache will delete the /usr/local/jakarta/tomcat symlink, and the files that support Tomcat 5.5. The original Tomcat 5.5 directory and libraries will remain in place if you need to migrate old libraries to the new location.

Startup options file locations

Tomcat 5.5

The Tomcat 5.5 startup script looks for options in the /var/cpanel/tomcat.options file.

When the startup script starts the Java service (jsvc), the startup script passes these options to the /usr/sbin/starttomcat script.

Tomcat 7

The Tomcat 7 startup script looks for options in the /usr/local/easy/share/easy-tomcat7/conf/tomcat.conf file. The system administrator can override these options with the /etc/sysconfig/easy-tomcat7 configuration file.

When the startup script starts the Java service (jsvc), the startup script passes the options to the /etc/init.d/easy-tomcat7 script.

Environment variables

The $CATALINA_HOME environmental variable refers to the shared installation directory. The $CATALINA_BASE environmental variable refers to the root directory for a specific instance.

  • In Tomcat 5.5, the $CATALINA_HOME environmental variable and the $CATALINA_BASE environmental variable point to the /usr/local/jakarta/tomcat directory.
  • In Tomcat 7, the $CATALINA_HOME environmental variable and the $CATALINA_BASE environmental variable point to the /usr/local/easy/share/easy-tomcat7 directory.

Reinstall and re-enable user servlets

After EasyApache completes an upgrade from Tomcat 5.5 to Tomcat 7, EasyApache will enable servlet support for any domains that had servlet support enabled prior to the upgrade.

You will need to reinstall and re-enable user servlets if you perform any of the following actions:

  • Modify an account with servlets.
  • Park a domain on an account with servlets.
  • Unpark a domain from an account with servlets.

For more information about how to enable Tomcat Servlets, read our Introduction to Tomcat documentation.

Note:

We will automate this process in a future release of EasyApache.

Library directory changes

Tomcat 5.5

Tomcat 5.5 stores libraries in the following directory structure:

  • Tomcat 5.5 stores each Java shared library in a separate directory.
  • Individual <classname>.class files which are in the $CATALINA_HOME/common/classes directory.
  • <libraryname>.jar files, which are in the $CATALINA_HOME/common/lib directory.

Tomcat 7

Tomcat 7 uses the /usr/local/easy/share/easy-tomcat7/lib ( lib) directory. The lib directory replaces the following directories from Tomcat 5.5:

  • server
  • shared
  • common

Tomcat 7 stores the following libraries in the $CATALINA_HOME/lib directory:

  • Java shared libraries
  • <libraryname>.jar files
  • <classname>.class files – Each class file is in a sub directory inside the $CATALINA_HOME/lib directory, with a directory hierarchy that mimics the class name.
    • For example, the My.Example.Name class is in the $CATALINA_BASE/lib/My/Example/Name.class directory.

InvokerServlet changes

Tomcat 5.5

cPanel & WHM enables the InvokerServlet method for Tomcat 5.5 by default. The InvokerServlet method allows you to designate a directory for servlets. The cPanel & WHM configuration of Tomcat 5.5 maps the InvokerServlet method to the the httpservlet and httpservlets directories.

To allow web users to invoke an HttpServlet-enabled servlet class files via URL, store the files in the httpservlet and httpservlets directories.

Tomcat 7

cPanel & WHM disables the use of the InvokerServlet method for Tomcat 7 by default.

Warning:

If you invoke a servlet through the InvokerServlet method, it will not function and Tomcat 7 will produce an error by default.

The change in functionality is due to how Tomcat 7 runs the InvokerServlet method. Tomcat 7 only allows the InvokerServlet method to run in privileged mode, which poses a significant security risk.

Warning:

We strongly recommend that you do not enable the InvokerServlet method. Instead, we recommend that you package servlets in WAR files.

To disable the the InvokerServlet method, cPanel & WHM comments out the mapping for the InvokerServlet method. To enable the InvokerServlet method, remove the commenting markup around the InvokerServlet mapping.

Log changes

Tomcat 5.5

Tomcat 5.5 uses the cPanel & WHM default logging facility, Valve, which stores logs in the /usr/local/jakarta/logs/ directory.

Tomcat 7

Tomcat 7 also uses the Valve logging facility, but stores logs in the /var/log/easy-tomcat7 directory. The logrotate.d application manages log rotation for Tomcat 7. Your operating system provides the logrotate.d application.

The logrotate.d application rotates Tomcat 7 logs weekly and keeps them for one year.

Account transfers

The following table includes information about how to transfer Tomcat accounts from one server to another:

cPanel & WHM version of destination serverServlet behavior
11.38.1.3 or latercPanel & WHM automatically enables Servlets.
11.38.1.2 or earlierYou must manually enable Servlets.

Warning:

You must install Tomcat on the destination server before you transfer the accounts.

For more information about how to enable Tomcat Servlets, read our  Introduction to Tomcat documentation.

WAR file deployment changes

Tomcat 5.5

In a Tomcat 5.5 installation, you unpack and deploy WAR files into the the work directory. For example, to unpack and deploy a WAR file named filename for the domain  example.com , unpack the file into the /usr/local/jakarta/tomcat/work/Catalina/example.com/filename/  directory.

Tomcat 7

cPanel & WHM disables the unpackWARs option in Tomcat 7 installations for permissions reasons. The process to unpack and deploy WAR files did not change for Tomcat 7.

The work directory has changed to the /var/cache/easytomcat7/Catalina/example.com/filename/  directory.

Warning:

If you re-enable the unpackWARs option, WAR files will fail to deploy properly and you will see an error that is similar to the following:

Jun 26, 2013 2:34:34 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
WARNING: JDBC driver de-registration failed for web application [/foo]
java.lang.NullPointerException
        at org.apache.catalina.loader.WebappClassLoader.clearReferencesJdbc(WebappClassLoader.java:2054)
        at org.apache.catalina.loader.WebappClassLoader.clearReferences(WebappClassLoader.java:1990)
        at org.apache.catalina.loader.WebappClassLoader.stop(WebappClassLoader.java:1902)
        at org.apache.catalina.loader.WebappLoader.stopInternal(WebappLoader.java:662)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5616)
        at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
        at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1575)
        at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1564)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:724)

Test accounts

Tomcat 5.5

If you install servlet support in Tomcat 5.5, Tomcat copies two files to the user's public_html directory:

Note:

In the above examples, replace example.com with the user's domain.

Tomcat 7

If you install servlet support in Tomcat 7, Tomcat copies only the jsptest.jsp file to the user's public_html directory.

deployXML disabled

cPanel & WHM sets the deployXML variable to false for Tomcat 7 installations.

Related documentation

  • Apache Tomcat – For more information on the Apache Tomcat web server, view Apache's Tomcat website.
  • Apache Tomcat Migration Guide – For more information on how to migrate the Apache Tomcat web server, read Apache's Tomcat Migration Guide documentation.