Java JEE beginners are often confused by some terminologies. Such as Servlet Container, Application Server and Web Server. They are related technologies in java JEE but they has a lot of differences also. In this article we will tell you what difference between them and when should you use them.
Servlet container offers runtime environment and services to execute JSP and Servlet only. It dose not support other JEE components such as EJB, JNDI, JDBC and Transaction Services etc. So it is also called light weight container. Jetty and Apache Tomcat are the most popular and famous servlet containers both are open source and totally free.
Application Server is one step further than servlet container, it not only support JSP and Servlet but it also support other JEE key features such as EJB, JNDI, JDBC , Transaction and Security etc. It provide business level service by using Enterprise Java Beans. It also provide Database connection pooling. It is heavy weight container. Oracle WebLogic, IBM WebSphere, Redhat’s JBoss and Glassfish are all famous and popular application server.
When to use web, application and servlet containers?
Knowing the main difference among those three server, it’s not hard to determine when you should use them.
If your Java EE application includes EJB, Message, JDBC Pool, JNDI etc, then you need to use application server such as WebSphere, JBoss or WebLogic.
If you want to support java web application which only use JSP or Servlet to produce dynamic web content, you need a servlet container, you can choose Apache Tomcat or Jetty.
By now you know all about the main differences between Java JEE Application Server , Web Server and Servlet Container. They are used for different purposes. But they can also used together when you develop Java JEE applications. You can use Apache HTTPD as the client tier while Tomcat as the web tier and JBoss as the business logic tier. This is called three tier java application structure. We will introduce more java and JEE technologies or code examples in subsequent articles. Please always come back to read our blogs for the tutorial you want to learn. Thanks a lot.