i

JAVA Complete Course

J2EE Container Types

Container is the application server which performs control and at the same time gives us services through an interfaces. J2EE container is the one which helps us to deploy and execute J2EE components. In J2EE specification there are five types of containers which are divided in two groups:

Server Side Containers:

  • Server, which provides J2EE runtime environment

  • EJB (Enterprise JavaBean) container which manages EJB beans

  • A Web container which manages servlets and JSP (Java Server Pages).

Client Side Contaienrs:

  • An application container for UI, batches or console

  • Applet  which is container meaning a browser; Usually it happens with Java plugin

Let’s shortly review each of them.

J2EE server: J2EE product which provides EJB and Web containers and happens at runtime

Applet Container: Applet container includes support for the applet programming model. The applet container is a mixture of java plugin and web browser on client machine. If applet container runs in an applet it guarantees with security and portability.

During applet execution there are following steps, we can refer them as a lifecycle of applet:

  • Loading of applet

  • Creation of applet

  • Initialization of applet with calling init() method

  • Starting of applet with calling start() method

  • Stopping of applet with calling stop() method

Application Client Container: For hosting application the application client container is used. It runs on the client computer. It helps developers to build powerful Java applications with having access to J2EE resources such as EJBs or data sources. The execution of application client components is managed by container. All application operations between users and databases can be handled by application server.

Web Container: Web container which is also known as servlet container is the one which runs web applications inside itself. A web container provides identical services as a JSP container. Web server is a component which is able to handle HTTP request send by a client and then send HTTP response back.

 

Enterprise JavaBean (EJB) Container: Enterprise JavaBean container is a server-side architecture. The main usage of it is to build modular structure of enterprise application. Enterprise JavaBean container provides a run-time environment for enterprise beans within the application server. It plays an intermediary role between the user-written business logic and the rest of the application server environment. Execution of enterprise beans for J2EE applications is managed by EJB. The EJB container provides local and remote access to enterprise beans. Enterprise bean depend on data can be divided into message-driven beans, entity beans, and session beans. Message-driven beans asynchronously pass messages to application modules and services. Entity beans represent persistent data, typically maintained in a database. Session beans represent transient objects and processes and typically are used by a single client.