J2EE Containers

The application server which control and provide services through an interface is  known as a container. J2EE container helps in deployment and execution of J2EE component. In J2EE specification we can classify container types as five. Three of these are server-side containers:

  • The server, which provides the J2EE runtime environment
  • An EJB container that manage EJB components.
  • A Web container that manage servlets and JavaServer Pages.

The other two container are client-side:

  • An application container for standalone GUIs, console, and batch-type programs — the familiar Java applications started with the java command.
  • An applet container, meaning a browser, usually with the Java Plug-in.

 

  • J2EE server: The runtime portion of a J2EE product. A J2EE server provides EJB and Web containers
  • Applet Container: Applet container includes   support for the applet programming model.  The applet container is a mixture  of web browser and java plug in on client machine . The applet container uses the sandbox security model, preventing applets from accessing system resources and causing harm. Applet container ensures security and portability if it runs in an applet.

An applet container follows the steps below while executing an applet:

  • Applet is loaded.
  • Applet is created.
  • Applet is initialized by calling the method init().
  • Applet is started by calling the method start().
  • Applet is stopped by calling the method stop().
  • Application Client Container: To host application components, application clients, the application client container is used. It runs on the client computer and it can be interacted with each other. It helps developers to create robust   Java applications that also have access to J2EE resources such as data sources or EJBs. This container manages the execution of application client components. Application clients and their container run on the client. Application server can handle all application operations between users and   databases
  • Web Container: A Web application runs within a Web container of a Web server which is also known as servlet container. The Web container provides the runtime environment through components. Web container manages the execution of JSP page and servlet components for J2EE applications.  A web container provides the same services as a JSP container .Web components and their container run on the J2EE server. Web server is a server which is capable of handling HTTP request send by a client and respond back with a HTTP response.
  • Enterprise JavaBean (EJB) Container: EJB container is a server-side component architecture. It is mainly used for modular construction of enterprise application. An EJB container provides a run-time environment for enterprise beans within the application server. The container handles all aspects of an enterprise bean’s operation within the application server. EJB container acts as an intermediary between the user-written business logic within the bean and the rest of the application server environment. It manages the execution of enterprise beans for J2EE applications. Enterprise beans and their container run on the J2EE server. The EJB container provides local and remote access to enterprise beans. Enterprise bean can be divided into session beans, entity beans, and message-driven beans depend on the data. Session beans represent transient objects and processes and typically are used by a single client. Entity beans represent persistent data, typically maintained in a database. Message-driven beans   asynchronously pass messages to application modules and services.