Have you ever thought what exactly Tomcat server is - Application server or Web server. In this article, we will discuss whether tomcat is an application server or web server.
Most of Java developers might have used tomcat server to deploy their web application. But do you know whether Tomcat is web server or application server? Most of the time we get confused whether tomcat is an application server or web server.
Let us understand Java EE Server and Containers.
In the above diagram, you can see the architecture of any Java EE Server. Every Java EE Application server has a Web Container + EJB Container. Web Container is used to host web application based on servlet and jsp whereas EJB Container is used to enterprise java beans based on EJB API designed to provide extended business functionality such as declarative transactions, declarative method level security, multiprotocol support, connection pool to database. Hence, for any Java server to be application server it should comprises of Web Container as well as EJB Container.
Considering the fact that any Java server to be application server it should comprise of Web Container + EJB Container. Let us discuss why Tomcat is Web server and Servlet Container, not an application server. Tomcat implements several Java EE specifications including Java Servlet, JavaServer Pages (JSP), Java EL, and WebSocket, and provides a "pure Java" HTTP web server environment for Java code to run in. But you cannot use Tomcat as an application server because it does not comprise of EJB container, JTA, JMS and many more Java EE services. Hence Tomcat is servlet container not an application server.
There are many Java EE Servers available in the market. Based on application one either use application server or web server or both.
In this article, we discussed the structure of Web server and application server and why tomcat server is considered web server not an application server.