Difference between web server and application server [duplicate]

As a layman, how do I understand the difference between web server and application server ? If you could give an example using a Java based web app in very "simple" terms that would be really great.. Also when we say Weblogic, is it a web server only ?

asked Jul 18, 2011 at 13:37 copenndthagen copenndthagen 50.4k 105 105 gold badges 308 308 silver badges 481 481 bronze badges Commented Dec 20, 2012 at 10:10

5 Answers 5

A web server is something that handles HTTP requests and responses.

An application server (like WebLogic, WebSphere, JBoss AS, Glassfish, etc) usually includes a web server, but also adds a lot more features. The most important is that it manages objects. Whether they will be servlets (Servlet container), EJBs (ejb container), JMS listeners, etc.

answered Jul 18, 2011 at 13:45 595k 146 146 gold badges 1.1k 1.1k silver badges 1.1k 1.1k bronze badges

can't agree more, just to add some samples: JBoss, Weblogic, Websphere,Glassfish are app servers, Apache Tomcat is servlet container, and "Apache HTTP Server" is web server .

Commented Jul 18, 2011 at 13:52

oddly enough, I listed exactly the same four app servers that you did, without seeing your comment :)

Commented Jul 18, 2011 at 13:54

Webserver can execute only web applications i,e servlets and JSPs and has only a single container known as Web container which is used to interpret/execute web applications

Application server can execute Enterprise application, i,e (servlets, jsps, and EJBs) it is having two containers 1. Web Container(for interpreting/executing servlets and jsps) 2. EJB container(for executing EJBs). it can perform operations like load balancing , transaction demarcation etc etc

answered Jul 18, 2011 at 13:47 Mobile Developer Mobile Developer 5,750 1 1 gold badge 40 40 silver badges 45 45 bronze badges

I would say definitions vary. In the generalized context, a Web Server is a server that can receive incoming web-requests and have knowledge about how they should be handled and responded to. Some requests are static (html files, images etc), some are dynamic. In the case of dynamic requests, the web server will know where to route handling of the request, could be a JSP page or a java servlet, a PHP script, a perl CGI script etc etc.

While the "web server" in this context executes the dynamic handler, it is not considered to include any supporting middleware features for the dynamic handler.

An Application Server, by contrast, is a general execution environment that offers some type of middleware tier support. Examples are EJB containers or the .NET framework built into Windows (in where Windows in itself is an "application server"). There is no inherent requirement that an application-server have anything to do with web requests (although many do), it's just a general execution context and container for any type of application that offers some sort of additional middleware support.

In a purely web-centric context, many people will draw the line at static vs dynamic content. In this definition, a "web server" can only handle requests for static information itself and it will pass on requests for dynamic content to the "application server". For example, Apache httpd is a web server and Tomcat is an application server. IIS is a combination of both. In the Java web world, an application server can be either a servlet container (like Tomcat), or a full blown Java EE container (like JBoss, WebLogic or WebSphere) that provides the Java EE middleware support (EJB) container in addition to the servlet container.