Getting Started with Tomcat 8 – What You Need to Know!
Apache Tomcat, also known simply as Tomcat, is a web server designed to run Java. It is based on several Java EE standards, allowing it to provide a suitable environment for Java-based websites and apps. The latest iteration, Tomcat 8, offers a wide range of new features and upgraded support for Java environments, including the Java Servlet 3.1 and JSP 2.3.
More About Tomcat 8
Tomcat 8 comes with several components. The first one is known as Catalina, a Servlet Container used by Tomcat at its core. Coyote acts as a connector between Java and Java environment within Tomcat with the standard HTTP 1.1 front-end interface. Jasper, on the other hand, is the primary JSP (JavaServer Pages) engine.
As mentioned before, Jasper in Tomcat 8 now supports JSP 2.3. Aside from JSP 2.3, Tomcat is also compatible with Java Servlet 3.1, EL (Java Expression Language) 2.3 and of course the Java Websocket 1.0. The combination allows Java-based apps, including the ones you develop on Eclipse, to run smoothly on top of Tomcat 8.
Tomcat also has several extra components, mainly designed to provide top-notch performance and great reliability. There is Cluster which acts as a load-balancer and environment manager. With Cluster, you can run large web applications and handle a large number of traffic without having to worry about performance.
Tomcat 8 also comes with High Availability, a component that can handle updates and upgrades of the entire environment without affecting the actual live environment. You can easily upgrade your Tomcat 8 and other parts of the server without ever having to take your web application offline.
Last but not least, there’s my favorite component: Web Application. This is the component of Tomcat 8 that enables you to deploy web application across multiple environments. It can also manage sessions and perform other tasks that will make going live with a new web or Java application very easy to do.
Tomcat & Apache: Best Practice
Tomcat 8 is more than capable of handling Java-based applications on its own. You can run Tomcat as a container of its own and have your web application deployed in no time. There is a great tutorial from HostPresto.com offering a run down of how to install it from scratch. However, as many experienced developers know, installing Tomcat in tandem with Apache is often the best way to go.
You can let Apache handle the usual dynamic and static content. Apache also allows you to use PHP and CGI as well as implement database frameworks and other server technologies easily. Tomcat, on the other hand, can focus more on running Java-based apps, JSP and scripts, allowing it to offer much better performance.
This type of implementation also enables you to scale the deployment of your apps. Tomcat and Apache are complimentary; how you implement the two depends highly on the kind of website or apps you want to run on the server. In most cases, the combination offers the best of both worlds.
Setting Up Apache Tomcat 8 on Linux Servers
The process of getting Tomcat 8 up and running is a fairly straightforward one to complete. You just have to complete a few simple steps and you will be ready for deployment:
– Install Java 8. Tomcat needs the latest version of Java Development Kit to run properly. You can download the Oracle Java JDK that suits the server operating system you use using wget. If you already have the JDK installed, simply update it to the latest version.
– Download and install Apache Tomcat 8. Again, this is a very straightforward step to complete. You can check the latest version available by visiting the official Apache Tomcat site. Create a directory for Tomcat (/opt/tomcat/) and use wget to download the necessary files.
– Once the installation is completed, use tomcatup command to test whether Tomcat is running properly. You can also access your host’s IP address to test Tomcat. You will see a Welcome page if the environment is installed properly.
– Change the port. By default, Tomcat 8 occupies port 8080 when installed. This is the default port of most web servers. If you are running Tomcat alongside Apache, this may cause some issues. A good way of avoiding problems is by changing the default port of Tomcat to 137 or other unused ports.
That’s it! Tomcat 8 is now installed and running. Use tomcatup and tomcatdown to start and stop Tomcat 8 whenever necessary. At this point, you can also start configuring the Tomcat 8 server to your liking. For example, you can add GUI users and change other things about Tomcat 8 by editing the configuration files inside ‘/opt/tomcat/apache-tomcat-8.0.23/conf/.
Tomcat 8: Highlighted Features
Tomcat 8 is considered a big leap forward, mainly because it introduces several new, very interesting features, such as:
-Servlet 3.1 now supports non-blocking I/O. This is a big step forward and will bring better overall performance to your Java apps.
-EL 3.0 can now run in standalone mode, allowing you to call the ELProcessor directly from within the application.
-Websockets 1.0 supports full-duplex mode, offering faster response and smoother data flow.