Is Tomcat An Application Server?
There is no simple yes or no answer to this question as it depends on where you stand in the mix of things.
The answer would be yes for those who are currently using it as an application server and a no for those who have deployed more complex servers due to one reason or the other.
What is not in doubt though is that it is currently one of the most widely used application servers in the market. As a matter of fact, many of today’s applications and virtually all web services can be built on top of Tomcat with a variety of add-ons and pluggable services readily available in the market.
It is no secret that many developers acknowledge that Tomcat is usually a much better choice to build today’s deployment and development architectures than other servers.
Tomcat is normally defined as a reference implementation of the Java Servlet and the Java Server Page (JSP) Specifications. It basically executes Java servlets and renders web pages which include JSP coding.
It is available on the Apache site in both source and binary versions. The product is a result of an open collaboration of developers and can be used either as a standalone product with its own web server (internal) or with other web servers. To get an objective view of the above, it is, therefore, important to first understand and agree on what is an application (app) server.
Want to host a Java-based application?
What Is An Application Server?
Initially, app servers were considered to be the hardware and operating system that’s used to run application code in what could be considered a two-tier environment. The other server used was known as a database server.
In later years, as web applications evolved, the UI (User Interface) gradually moved to the client machine while the business logic remained in the app server with the database still retaining its server. Later, Java application servers were introduced and things started to change.
These servers were based on Java 2 Platform and Enterprise Edition (J2EE) which adopted a multi-tier distributed model. The model above did include a Data Tier, a Middle Tier and a Client Tier.
The J2EE platform resided in the middle tier and consisted of lots of stuff such as an EJB server, a Servlet Container, a web server etc. These servers can also be referred to as containers.
The client tier consisted of several applications and/or browsers. The data tier, on the other hand, provide databases and/or data services.
An application server can be defined as the code, container or framework that sits between the Operating System and the application. It is usually charged with the responsibility of providing a suite of services for the application.
It also provides the infrastructure for developing, deploying and running applications. Some of the common characteristics of an application server can thus be categorized as follows:
- Fits between the JVM or OS layer and the application layer
- Supports multiple applications simultaneously
- Provides components (services) to the application, thereby eliminating the need for the application developer to create or even attempt to manage and integrate these services from the beginning
- The services being provided are implicitly or explicitly invoked by the application on a need basis and are not therefore coded into the application and finally,
- Mostly, but not always, an app server will include a configuration/administrative function that’s used for managing the environment and its functional applications.
Confusion over whether Tomcat is an application server is quite common amongst Java developers with some claiming Tomcat is absolutely an application server while some claiming it isn’t.
The truth though is that Tomcat is frequently used as an application server.
As a matter of fact, there are lightweight applications where Tomcat does shine as an app server and then there are more complex service oriented architectures where one would be better off using what can be termed as a full-fledged Java Platform Enterprise Edition (Java EE) application server. It thus follows that to clearly find out if Apache Tomcat is an application server or not, then we need to gauge it against the Java EE specifications.
Using Java EE as a Reference Point
Generally, Java EE is considered as the de facto standard that’s used to develop server side applications. In this regard, it is the foundation on which all server side technologies which include app servers must rest.
Java EE compliance is, therefore, an important cog for any app server. A compliant Java EE application is therefore expected to support a number of features; these include but are not limited to the following:
- JNDI capabilities
- Enterprise JavaBeans (EJB) container and server
- Java Transaction API (JTA) framework
- Java Message Service (JMS) framework
- J2EE Connector Architecture
- EAR files
- JavaServer Pages or JavaServer Faces
- JAAS (Java Authentication and Authorization Service)
- JAF (JavaBeans Activation Framework)
- JPA (Java Persistence API)
- JTA (Java Transaction API)
- SAAJ(The SOAP with Attachments API for Java)
- JDBC (Java Database Connectivity) Framework
- JAXB (The Java Architecture for XML Binding)
- JAX-RPC (The Java API for XML-based RPC)
Further to the above Java EE does define containers for client applications, EJB components, and servlets. These containers normally provide structure as well as functionality that not only facilitate the deployment, but also the persistence and execution of all supported components.
J2EE does also define a standard architecture that’s used to connect Java EE applications and application servers to heterogeneous Enterprise Information Systems such as non-Java legacy applications, database systems, mainframes and ERP systems.
Simply put, the JavaEE specifications are a set of rules, they basically contain the interface. Thus, any JavaEE servers which need to comply with specifications need to have the implementation of these interfaces.
It is at this point where the major difference between a JavaEE server and Tomcat come in quite clearly with most people who believe it is solely a web server coming in hard.
This is mainly because if you are deploying any enterprise application, meaning that you have some technology such as EJB, JPA etc which are part of the JavaEE set to the server which is compliant, then your lib will not need to contain any API implementation jars. However, if you are using Tomcat for deployment, then you will have to add these API implementation jars.
This does explain why many Java based web applications are normally deployed to environments that support a wide array of technologies that are found in a web container/server such as JavaServer Pages (JSP), JDBC and servlets. In such a scenario, a Tomcat application server comes in very handy when compared against a Java EE application server which may find these environmental constraints a tad difficult to adapt to.
On the other hand, a Java Web application is normally said to combine a subset of Java Enterprise application components and technologies such as:
- JDBC (Java Database Connectivity) Framework
- Java Servlets
- WAR files
- Java Servlets
In a typical Java EE web application, HTML clients are required to simply post a request to a server where the request is handled by a web container of the application server being used. At this point, it is the web container that’s charged with the responsibility of invoking the Servlet that’s been configured to handle the specific or exact context of the request.
Going by the above-mentioned details, it follows that strictly speaking Tomcat should be referred to as Tomcat web server or a JavaServer/Servlet container since there are certain conditions and services of a commercial JEE Application server that it doesn’t offer its users.
However, it does cover for these faults by including the most widely used services and supports add-ons as well as plug-ins which make server enhancement quite easy. The main advantage of this server, therefore, lies in its architecture which allows users to leave out what they don’t need, use what they need and install what they may be lacking.
Because of this, Tomcat is often used as an application server for strictly web-based applications even though it doesn’t include the entire suite of capabilities that a standard Java EE application would have on offer.
Inherent Advantages of Apache Tomcat
Apache Tomcat is a widely used application with slightly more than a million downloads a month. Its overall success has been due to its lightweight, effective and efficient nature.
This is because as earlier mentioned; Tomcat does implement JSP and Servlet which is basically what many applications tend to depend on.
Because Apache Tomcat is not a Java EE engine, it is possible to keep it lightweight and upload any add-ons on a need basis. This not only makes it versatile and flexible but also ensures that it can continuously meet the needs of most web applications.
Since Apache Tomcat is an open source product, it does enjoy the benefits of well thought out and thoroughly tested updates as many well trained and highly experienced developers and other volunteers are usually given an opportunity to offer their input.
This does give the product a distinct advantage since the skills- set that it borrows from is quite wide and diverse. It is also important to mention that since it is open source, getting updates and using it with other products is not only seamless but also quite simple and straightforward.
Another main advantage of the product is the ease of installing and configuring the application. Typically, this can be done in less than twenty (20) minutes. It is also worth mentioning that deploying web applications to Tomcat is also very easy and simple.
Apache Tomcat Growth and Upgrades
Over the years, the Apache community has continued to introduce new components into the Tomcat. These include components such as cluster, web application, and high availability. The cluster component has been added to help in the management of large applications.
The cluster is mainly used for load balancing and can be achieved through a number of techniques. Currently, one is required to have JDK version 1.5 or later so as to support clustering.
The high availability feature has been added so as to facilitate the scheduling of system upgrades which includes but is not limited to change requests and new releases that don’t affect live environments.
This is usually achieved by simply dispatching live traffic requests to a different server which is located to a different port as the main server is upgraded or replaced on the main port. This is an indispensable feature when handling user requests on applications that are considered high traffic.
The web application comes for both system and user based application enhancements, all these make it pretty easy to deploy across a variety of environments, be it mobile, desktop or even remote based. The component does also manage applications as well as sessions across the network.
It is worth mentioning that there are a whole lot of components which users can either opt to build on their own or download from one of the numerous mirrors and then proceed to upload into the server. It is also important to note that by adding some administrative services from other vendors, it is possible to meet IT operations requirements; giving users a complete suite of services at any given time.
As earlier mentioned, defining whether Apache Tomcat is an application server is dependent on who you are talking to.
Those who develop rather lightweight and not too complex web based applications will vouch for it as an application server since they use it quite effectively and efficiently on a daily basis as an application server. The few add-ons that they need to deploy from time to time notwithstanding.
However, those developers who for one reason or the other have failed once or severally in trying to use Apache Tomcat in more complex web-based applications will be quick to dismiss it as a web server and will also rightfully remind anyone willing to hear that Apache Tomcat doesn’t meet the Java EE specifications which are a pre-requisite for any application server that wants to interface with the Java family.
Whichever the case, the truth though is that even though Tomcat cannot be technically defined as an application server, it is continuously and successfully being used as an application server for millions of mission-critical applications on a daily basis. The jury is still out there.