Manu develops software applications using Java and related technologies. Geek, Tech Blogger, open source and web enthusiast. Manu has posted 12 posts at DZone. You can read more from them at their website. View Full User Profile

Why is Tomcat a Webserver and not an Application Server

  • submit to reddit
Many application developers do not focus much on the infrastructure on which their code runs. When it comes to web applications there are common confusions like what is the difference between webserver and applications server or when to go for a EAR vs WAR file deployment etc...
There are many good answers that differentiate between web servers and applications servers like this one. Most of the times the terms Web Server and Application server are used interchangeably. This article explains the working of a typical web server. Typically we get confused with the example of Tomcat Server (an example for a web server) having the capability to run the enterprise applications. So, tomcat is a web server or an application server? Let me tell you how I convinced my self regarding this.
Some time back I was struck with the question What's the difference between JPA and Hibernate on stack overflow. I did answer it, but one of the comment lead me to a more detailed understanding of the JavaEE spec and certified servers. If you can understand this then differentiating between the web server and application server is easy. During my investigations I got this article, which discusses the advantages of both.
A more detailed look in to the meaning JavaEE specification will throw some light in to our discussions. As we know specifications are set of rules. Simply put they contain the interface. Any JavaEE servers which needs to comply to spec needs to have the implementation of these interfaces. You can find the certified JavaEE servers list here. If you are deploying your enterprise applications (means you have JPA, EJB or some technology which is part of Java EE) to the a server which comply to JavaEE then the lib need not contain the API implementation jars. But these are needed if you are using a web server like tomcat for deployment.
For example, if you use JPA in your applications and deploying it to the  Jboss AS 7, then you need any additional jars in the lib. But the same application you want to deploy to the tomcat server then you need to have additional jars to lib that implements the JPA spec may be eclipselink or Hibernate. This is what makes JBoss AS 7 an application server and tomcat a web server. Another key difference is that we can not deploy an EAR file to tomcat, it could only handle WAR files.
Published at DZone with permission of its author, Manu Pk. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Michal Xorty replied on Sat, 2014/01/04 - 4:44am

I disagree with your explanation. Application server is server that can run your application. It's simple as that.

Java EE spec for some unholy reason claims that "application server" should be only JavaEE-compliant server. That is utterly wrong. If Java EE guys want to have their own buzzword, one should use "Java EE Compliant Application Server", which sounds a bit stupid but hey, you asked for it ;-)

Manu Pk replied on Sat, 2014/01/04 - 10:38am in response to: Michal Xorty

Even a webserver can run applications!! so whats the difference between them? This is the point discussed here...

You might be right because the terms are used differently in different contexts. So, I choose the one mostly agreed by the community (in stack overflow) here. Further, the above article speaks from a Java EE context and looks in to the difference between web server and applications server.

Michal Xorty replied on Sat, 2014/01/04 - 6:49pm in response to: Manu Pk

I understand what are you trying to say here and I respect your opinion (and many other people in Java community share that one too), but I still find myself in disagreement. The point here is that term "application server" is rarely used for anything useful but mere marketing. 

Example: "Hey, don't just use lame web server! We have this full-blown feature-rich Oracle WebLogic or IBM WebSphere" ... or other crap.

I personally refer to "application server" as general-purpose server that can run applications. Tomcat? Sure, it runs e-banking we just made. Does it sound "application enough" to you? :) How about IIS? Why not, it can run .NET applications! How about this RoR application we just wrote? It makes millions of dollars but it does not run on "application server"? Does only Java EE have the privilege to have "application server"? Web server from my point is more specialised version of application server.

When I want to refer to "something like Tomcat or Jetty" I use term "servlet container" and when I want to refer to JBoss AS or WebSphere or so I use the term "Java EE compliant application server".

In my humble opinion I think it's way too misleading to use such generic term as "application server" for concrete instance of "sever that implements Java EE runtime".

Marc Stock replied on Tue, 2014/01/07 - 10:45am

Are you seriously arguing that for something to be an "application server" it must support J2EE?  That's asinine.  Thousands of websites run real, enterprise, dynamic web applications on Tomcat all over the world.  J2EE is just more slop on the pig.

Shahzad Badar replied on Wed, 2014/01/08 - 8:49am

 As name suggests , An Applciation Server is a server that exposes business logic to client applications through various protocols including HTTP whereas Web Server is a server that handles HTTP requests only. That's it.

However, Yes in JEE world, We use to call a server an application server if it can run services (applications) like EJB, JMS etc with serving HTTP requests (Servlet, JSP)

Peter Schuetze replied on Wed, 2014/01/08 - 9:06am

 I have to come to the support of Manu Pk. The term application server was introduced with JavaEE. Just because webserver can do part of what app servers can don't make them app servers. Do you consider an OS as an application server? It can run applications?

Same is true for the term Databases. MySQL used to not be a real database (don't know if it is one now). Reason is, that it didn't support all functions that are expected of a DBMS (google for Codd for more details).

Just like in the real world. I would not consider a Ford Fiesta hatchback a truck even though I used to hauled quiet a bit with it.

Just my 2 cents

Marc Stock replied on Wed, 2014/01/08 - 10:28am in response to: Peter Schuetze

Welcome to bullshitville.  The J2EE requirement to be an "app server" is a marketing scheme to make it seem like only J2EE servers are real servers.  If your server runs web applications, then it's an app server.  

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.