Published on Jul 3 2013 in

_Apache Tomcat hosting is outstanding and most popular product offered by JVM Host. Our private/dedicated Tomcat packages come with Best Price Guarantee and 30-day trial. Any Java framework, library, jar and application is supported with our private JVM. And you can of course combine your Java hosting with classic LAMP stack. Check our Tomcat hosting packages!

About Apache Tomcat - Introduction

The Apache Tomcat server is Java-based, open source reference implementation (RI) web application and servlet container created to run servlets and JavaServer Pages (JSP) based web applications. It was developed as Apache Jakarta subproject since 1999. Since 2011 it is distributed as a separate Apache Tomcat project, where it is supported and enhanced by a group of volunteers from the open source Java community. It is a free, open source implementation of the Java Servlet and JavaServer Pages specifications that were developed under the standard Java Community Development Process.

Apache Tomcat is very stable - also thanks to its immense number of users and - and has all of the features of a commercial web application container still it is delivered under Open Source Apache License. It is #1 product among Java hosting products.

Tomcat also provides additional functionality that makes it a great choice for developing a complete web application solution and then hosting it. Some of the additional features provided by Tomcat include the Tomcat Admin and Manager applications, JNDI, SSL, logging interfaces (JULI, Log4j, Slf4j), connectors for different protocols, specialized realm implementations and Tomcat valves and filters.

Currently supported versions on Apache Tomcat are 5.5.x, 6.0.x, 7.0.x and 8.0.x. Versions earlier than 5.5 are still available for download, but they are not supported anymore, so users are encouraged to use the latest version of Tomcat. You can host any Tomcat and Java version with our hosting products.

Major versions on Apache Tomcat coincide with versions of the Java Servlet specification, or Java Servlet API. So, Tomcat 5.5.x supports Servlet API 2.3, Tomcat 6.0.x supports Servlet API 2.5 (JSR 154), Tomcat 7.0 is a reference implementation of Servlet API 3.0 (JSR 315) and Tomcat 8.0 of Servlet API 3.1.

In addition to Servlet API versions, Tomcat versions also support corresponding JSP versions. The JVM compatibility also depends on the version chosen. Below table provides a reference for Tomcat versions, supported JVM versions, and Servlet API and JSP API releases.

Below table presents Tomcat Versions and Supported API and JDK Versions

Apache Tomcat Servlet API JSP API JDK
8.0 3.1 2.3 1.7
7.0 3.0 2.2 1.6
6.0 2.5 2.1 1.5
5.5 2.4 2.0 1.4
4.1 2.3 1.2 1.3
3.0 2.2 1.1 1.1

Apache Tomcat Architecture

A Tomcat instance, or server, is the top-level component in Tomcats container hierarchy. Only one Tomcat instance can live in a single Java Virtual Machine (JVM). When hosting your Java apps with us you are provided with dedciated JVM. This approach makes all other Java applications, hosted on the same physical machine as Tomcat server, safe in case a Tomcat and/or its JVM crashes. Other Tomcat instances running on the same machine use different port sets.

Tomcat instance consists of container sets, that exist in the well-defined hierarchy. The main component in that hierarchy is the Catalina servlet engine. Catalina is the actual Java servlet container implementation as specified in Java Servlet API. Tomcat 8 implements Servlet API 3.1, the latest specification from Oracle.

In Tomcat's conf/server.xml the conainters are defined in XML as below.

<Server>
   <Service>```
  <Connector />
      <Engine>
         <Host>
            <Context> </Context>
         </Host>
      </Engine>
   </Service>
</Server>

Visual relationship of Tomcat components is shown on the following figure.

Apache Tomcat Architecture
Tomcat instance can be split into a set of containers including a server, a service, a connector, an engine, a host, and a context. By default, each of these containers is configured using the server.xml.

The Server is topmost container element. It represents the entire Catalina servlet engine. It can contain one or more Service containers. The Service element holds one or more Connector elements (typically HTTP, SSL, AJP) that share a single Engine element. A number of Service elements may be nested inside a single Server element.

The Connector element defines the class that handles requests and responses to and from a client application sent with different protocols.

The Engine is the next element going inward. Each Service can have only one Engine element, and this _Engin_e component handles all requests received by all of the defined connectors.

The Host element defines the virtual hosts that are serviced by each instance of a Catalina Engine. You can have multiple hosts and each can be mapped to a separate web application using Context. Inside Host you can use Alias directive to have a Host service multiple domains with the same web application set. Each Host can hold multiple web applications, with each of them being represented by a Context component.

The Context element is the most commonly used container in a Tomcat instance. Each Context represents a single web application running within a Host. There is no limit to the number of contexts within a Host.

Installing and Configuring Apache Tomcat

Our packages comes with preinstalled newest Tomcat version and JDK 8 version. You are free to use our custom Java Control Panel and change to your preferred Apache Tomcat and JDK versions. They are just a few clicks away. Your existing tomcat directory will be backed up in your home directory with datetime appended to its name so you can easily revert or copy your webapp to the new instance with no need to reupload. Tomcat is configured to use your dedicated ports and also to receive requests for your domain. Passing requests from HTTP (and HTTPS if you have SSL certificate installed) port is performed internally using AJP (or optionally HTTP) protocol. By default all requests are passed by the webserver frontend to your Tomcat. You can change it in Java Control Panel - Mappings section if you need to have some URLs to be handled by webserver only (for PHP, Perl, Python apps). Java and Tomcat related environmental variables (JAVA_HOME, JRE_HOME, CATALINA_HOME, CATALINA_PID etc.) are already set for you in shell resource script. Your only task is to upload your web application to Tomcat webapps directory and set database connection credentials. Typical Tomcat Hosting Data Flow is shown below.

Tomcat Hosting Data Flow
On the above figure you can see different access channels when hosting your Tomcat/Java with us. Green line with port specified accesses Tomcat built-in webserver directly (HTTP connector). Red one with port does the same but reaching SSL connector. Default access methods allow you to skip port specification in URL but in this case requests will go via Apache Webserver frontend. Thanks to the mapping (mod_proxy_ajp or mod_jk modules) the requests are internally passed to proper Tomcat instance and correct web application is served. Mapping management in our Java Control Panel is very important feature of Tomcat hosting and it allows you to set what URLs are passed to the Tomcat and what are served by Apache from public_html (PHP, Perl, Python). With a single account (single Tomcat/JVM) you can host multiple web applications and map them to different domains using Host element in server.xml.

Example Tomcat Deployment using Tomcat Manager

Basically Tomcat hosting is as easy as updating database credentials in your web application and uploading WAR file to your Tomcat webapps directory. This can be done with any FTP or SCP client software (e.g. Filezilla, WinSCP). Alternative deployment method is using Tomcat Manager. There are 6 easy browser-based deployment steps:

1. Login to Java Control Panel (JCP) and find Tomcat Manager credentials and URL.

In the New Hosting Account Created email you will find username, password and JCP URL plus other account related details. Login to JCP and at the bottom of the Appserver page you will find Tomcat Manager and Tomcat Host Manager URLs and credentials. Click Tomcat Manager link and login. If your application uses a database please create it first from cPanel and load data if necessary.

2. Upload your web application (.war file) to the Tomcat

Upload your application as WAR archive (it will be auto deployed). You may also use the Tomcat Manager to undeploy your application later. Alternatively you can upload your WAR to webapps directory with a FTP client like Filezilla.

3. Access your application at your yourdomain.com/sample

Note, your application name sample is appended to the domain name to form correct default URL for accessing your application. Optionally, if you want to have your Java application served from root URL yourdomain.com instead of yourdomain.com/sample you need to follow 3 additional steps:

4. Undeploy '/' application in Tomcat Manager to make room for new ROOT application

Click Undeploy in '/' row and the default ROOT application will be removed from webapps directory of your Tomcat. In the next step sample.war will be deployed at '/' context path.

5. Deploy sample.war at / (ROOT) URL in Tomcat manager

After sample.war (see file:sample.war used in WAR or directory URL field) is deployed you can undeploy /sample to free memory. sample.war has already been renamed to ROOT.war by Tomcat and is no more needed.

6. Enjoy your application being served from your domain root URL

For the above fast guide we used sample.war provided by Tomcat developers and jvmhost.net subdomain for root URL example. A jvmhost.net subdomain is available free of charge to every client who wants to use it instead of a regular domain.

Tomcat hosting offer at JVM Host

Why host your Tomcat with us?

We know what Tomcat hosting clients need because we listen to them:

Need more details than above? Check features list and highlights or contact us.

Additionally:

If you are unsure what you need please order a trial package or contact our technical support via chat or a ticket.

Too good to be true? Check with our Tomcat Trial package!

Having dedicated JVM and dedciated Tomcat running within it allows you for full control over them both and gives you ability to use any framework, library and jar you wish including most popular ones like: Struts, Spring, Hibernate, Stripes, JSTL, Grails, ZK, Vaadin, Java Server Faces, MyFaces, Wicket, Tapestry, Taglibs, Cocoon, SiteMesh, JPA, WebSockets, Makumba, GWT, IceFaces and RichFaces.

Reviewing alternatives? Still shopping? Please bookmark us - we're confident that you'll want to come back.