Java : Major differences between Application Server and Web Server

We can host a Java web Application using Application server and web. Even though both application server and web server are generic terms, difference between application server and web server is a most asked  java Interview question.

In Java J2EE the main difference between the Application Server and Web server is in the usage of EJB. In order to run a EJB enterprise application  or host enterprise Java application (.ear) file you need an application server. Few application servers are: JBoss, WebLogic, WebSphere or Glassfish.

You can still run your servlet and JSP or java web application (.war) file on any web server like Tomcat or Jetty.

This Java interview question are in sequel of my previous post on interviews like Basic Spring Interview Questions and Answers

Find some difference between application server and web that will help you to answer this question in any java interview.

Application Server vs Web Server

1.  Important deference is, Application Server supports distributed transaction and EJB whereas Web Server only supports Servlets and JSP.

2. Application Server can contain web server within them. Most of the Application server e.g. JBoss or WAS has Servlet and JSP container.

3. Application server provides functionalities like Connection pooling, Transaction management, messaging, clustering, load balancing and persistence. Apache tomcat also provides connection pooling.

4.Web server is supposed to provide http protocol level service while application server provides support to web service and expose business level service e.g. EJB.

5. Application server heavy compared to web server in terms of resource utilization.

Even though I personally don’t like the Difference between Application Server and Web Server. As it asked in many companies, you got to be familiar with some differences. Sometimes different interviewer expect different answer and we need to be prepared as part of our interview preparation.

Add comment