Apache Tomcat



Apache Tomcat provides the basic feature of web server processing for the relevant servlets. It supports the java servlet lifecycle that are init,service and destroy phases. It is the preferred web server software for Java implementations The latest stable release of a tomcat version 9.0.21 was released on June 7 th, 2019. Apache Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies.

Apache Tomcat Tutorial

Welcome to Apache Tomcat Tutorial. Learn to use Apache Tomcat as a JSP container, HTTP Web Server, etc., and understand configuration for security and scalability with examples.

Apache Tomcat

Latest version available is Apache Tomcat 8.5.X.

Apache Tomcat Tutorial – Index

  • Managing Tomcat
  • Deploying Web Applications with Apache Tomcat
Tomcat

Introduction to Apache Tomcat

The Apache Tomcat software is an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies.

Apache Tomcat is usually used as a Servlet Container even though Tomcat has a fully functional HTTP Server to serve static content. In most of production, Tomcat is used in conjunction with Apache HTTP Server where Apache HTTP Server attends static content like html, images etc., and forwards the requests for dynamic content to Tomcat. This is because Apache HTTP Server supports more advanced options than that of Tomcat.

Latest Apache Tomcat version 8.5 adds support for HTTP/2, OpenSSL for JSSE, TLS virtual hosting and JASPIC 1.1

Components and Features of Apache Tomcat

Apache Tomcat has following components and features to manage web applications.

  • Catalina
  • Coyote
  • Jasper
  • Cluster
  • High Availability
  • Web Application

Jasper 2

Jasper is the JSP Engine for Tomcat. Jasper is responsible for parsing JSP files and compilation of JSP’s Java code as servlets.

Jasper is capable of background compilation, which means if any changes are made to JSP files, then the older versions of those JSP files are still retained by the server, until the updated JSP files are recompiled.

Catalina

Catalina is Tomcat’s servlet container. Catalina makes Tomcat a Web Server for dynamic content.

Coyote

Coyote is the component that makes Tomcat capable as a HTTP Web Server. Coyote makes Catalina also act as a server that serves static content.

Installing Apache Tomcat on Ubuntu

To install Tomcat on Ubuntu, you could use command line interface and run the following command :

If you would like to install tomcat7 for some project related reasons, use tomcat7 instead of tomcat8 in the command.

Following are the useful locations that we may need in furthur steps :

  • /etc/tomcat{X} for configuration
  • /usr/share/tomcat{X} for runtime, called CATALINA_HOME
  • /usr/share/tomcat{X}-root for webapps

You could check if the Tomcat server is running, by opening a browser and hitting the url http://localhost:8080/.. Something similar to the following would be responded back with.

Start Apache Tomcat

Once you install Tomcat, it is started automatically.

In case if you have stopped it manually, and would like to start Apache Tomcat again, open a terminal and run the following command.

Apache

Restart Apache Tomcat

There could be scenarios, like you have updated your web-application, where you may need to restart Apache Tomcat for the server to pickup the changes.

To restart Apache Tomcat, Open a Terminal and run the following command.

Apache Tomcat 9.0 Download

Stop Apache Tomcat

To stop Apache Tomcat, Open a Terminal run the following command.

If you have installed tomat7, use tomcat7 instead of tomcat8 in the above command.

Deploying Static Web-Applications with Apache Tomcat

In the following sections, we shall learn to deploy static and web applications in tomcat.

Deploying Static Web-Applications with Apache Tomcat

To deploy static web application with Tomcat, all you need to do is copy your project folder to tomcat web-apps directory.

For Linux :

Apache tomcat 8

Apache Tomcat Meaning

Now restart Tomcat for the changes to take effect.

Apache Tomcat

Open a broswer, and hit the url, http://localhost:8080/StaticWebProject.

Deploying Dynamic Web-Applications with Apache Tomcat

.war is the format of the web application that Apache Tomcat Server could deploy. If you are building a web application using an IDE like Eclipse, you could export the application as a WAR file.

Conclusion

Apache tomcat download

Apache Tomcat Tutorial

With these series of tutorials, we have learnt how to configure and work with Apache Tomcat.