Java EE

12 minute read

Related with: Sysadmin | WebLogic. Topics:

Java EE (Enterprise Edition), now know as Jakarta EE and previously as J2EE, differs from the Java SE, adding libraries which provide functionality to deploy fault-tolerant, distributed, multi-tier Java software, based largely on modular components running on an Application Server, known as Enterprise Applications.

The platform reduces the complexity of development by providing a development model, APIs and a runtime environment. Provides libraries for database access (JDBC, JPA), remote method invocation (RMI), messaging (JMS), web services, XML processing, and defines standard APIs, such as EJBs, servlets, portlets and JSP/JSFs.

javaee architecture
High leve Architecture

Distributed Multitiered Applications

The functionality of the application is separated into isolated functional areas, called tiers. Typically, multitiered applications have a client tier, a middle tier, and a data tier, extending the standard client-and-server model.


Java EE applications are made up of components. A Java EE component is a self-contained functional software unit that is assembled into a Java EE application with its related classes and files and that communicates with other components. The differences between Java EE components and “standard” classes are that they are assembled into a Java EE application and verified to be well formed, in compliance with specification, to be deployed in the Java EE AS.

The Java EE specification defines the following components:

  • Application clients and applets are components that run on the client.
  • Servlet, JSP/JSF technology components are web components that run on the server.
  • EJBs are business components that run on the server.
The Client Tier

The client tier consists of application clients that access a Java EE server and that are usually located on a different machine from the server. The clients make requests to the server, to processes the requests and returns a response back to the client.

Many different types of applications can be Java EE clients, that may not be Java applications. A web client consists of two parts:

  • An Application Client with dynamic web pages containing various types of markup language, generated by web components running in the web tier
  • A Applet or browser, which renders the pages received from the server
The Web Tier

The web tier consists of components that handle the interaction between clients and the business tier and are part of the web tier. Java EE web components are either servlets or web pages created using JSP/JSF technology. Its primary tasks are the following:

  • Dynamically generate content in various formats for the client
  • Collect input from users of the client interface and return appropriate results from the components in the business tier
  • Control the flow of screens or pages on the client
  • Maintain the state of data for a user’s session
  • Perform some basic logic and hold some data temporarily in managed beans
The Business Tier

The business tier consists of components that provide the business logic for an application, handled by EJBs, in the middle tier.

The Enterprise Information Systems Tier

The EIS tier consists of database servers or other data sources, that typically are located on a separate machine, in the data tier, and are accessed by components on the business tier. the EIS tier are used via JDBC, JPA, JCA or JTA.

Java EE multitiered structure

Java Containers

A Java EE AS, also know as Java EE server, implements the Java EE platform APIs and provides standard Java EE services. The apps are developed according to the Java EE specification and can be deployed in any Java EE AS.

It’s the runtime portion of a Java EE product. A Java EE server provides EJB, web and JCA containers and JMS provider

The Java EE architecture is organised into reusable components (corresponded to the tiers) and provides services in the form of a container for every component type. Containers are the interface between a component and the low-level, platform-specific functionality that supports the component. Before it can be executed, a component must be assembled into a Java EE module and deployed into its container.

The assembly process involves specifying container settings, different for each component, that customize the underlying support provided by the Java EE server and can behave differently based on where they are deployed. The configurable services can be:

  • security: system resources are accessed only by authorized users.
  • transaction management: lets you specify relationships among methods that make up a single transaction so that all methods in one transaction are treated as a single unit.
  • JNDI API lookups: unified interface to multiple naming and directory services in the enterprise so that application components can access these services
  • Remote connectivity: manages low-level communications between clients and enterprise beans. After an enterprise bean is created, a client invokes methods on it as if it were in the same virtual machine.

The container also manages nonconfigurable services, such as enterprise bean and servlet lifecycles, database connection resource pooling, data persistence, and access to the Java EE platform APIs

The Web Container

The interface between web components and the web server. A web component can be a servlet or a JSP/JSF. The container manages the component’s life cycle, dispatches requests to application components, and provides interfaces to context data.

The EJB Container

The EJB container is the interface between EJBs, which provide the business logic in a APP ou AS. Manages the execution of web pages, servlets, and some EJB components for Java EE applications. Web components and their container run on the Java EE server.

The Application Client Container

Runs on the client machine and is the gateway between the client application and the Java EE server components that the client uses.

Applet container

Manages the execution of applets. Consists of a web browser and a Java Plug-in running on the client together.


The Java EE platform provides the XML APIs and tools for web services.


Enterprise JavaBeans are intended to provide encapsulated business logic for enterprise applications within a general container that provides session management, security, resource pooling as services. An EJB can be used alone or with other EJBs to execute business logic on the Java EE AS and are either:

  • A session bean represents a transient conversation with a client. When the client finishes executing, the session bean and its data are gone.
  • A message-driven bean combines features of a session bean and a message listener, allowing a business component to receive messages asynchronously, commonly JMS messages.

Learn more in the Java EE documentation


A servlet is a class which responds to a particular type of network request, such as HTTP requests and usually used to implement web applications. Servlets run in a servlet container which handles the networking side.

Learn more in the Java EE documentation


JavaServer Faces technology is a user interface framework for building web applications and Tag libraries for adding components to web pages and for connecting components to server-side objects

JavaServer Pages is a technology to create dynamically generated web pages based on HTML/XML, using Java or JSP elements, which determine how the page constructs dynamic content. To deploy and run JSP, a compatible web server with a servlet container is required.

Learn more in the Java EE documentation


The Java Persistence API is a Java API specification that describes an object/relational mapping approach to bridge the gap between an object-oriented model and a relational database. The Java Persistence API can also be used in Java SE applications outside of the Java EE environment.

Learn more in the Java EE documentation


The Java Transaction API provides a standard interface for demarcating transactions, enabling distributed transactions (two or more network hosts are involved) to be done across multiple X/Open XA resources in a Java environment.

When transactions need to span resources, an AS can act as the transaction manager. The Java EE architecture provides a default auto commit to handle transactions where any other applications that are viewing data will see the updated data after each database read or write operation. However, if your application performs two separate database access operations that depend on each other, you will want to use the JTA API to demarcate where the entire transaction, including both operations, begins, rollback, and commits.

Learn more in the Java EE documentation


The Managed Bean represents a resource running in the JVM, such as an application or technical service (transactional monitor, JDBC driver). They can be used for collecting statistics on concerns like performance, resources usage, problems or for getting and setting application configurations or properties. It’s a type of JavaBean, created with dependency injection, particularly used in the JMX technology

Learn more in the Java EE documentation


JMS (Java Message Service) is a messaging API that allows application components to create, send, receive, and read messages. It allows the communication between different components of a distributed application to be loosely coupled, reliable, and asynchronous.


Java EE Connector Architecture is a solution for connecting AS and EISs, as part of EAI solutions. A generic architecture for connection to legacy systems, used by tools vendors and system integrators to create resource adapters that support access to EISs that can be plugged in to any Java EE product.

Other APIs

Java EE APIs:

  • Java API for RESTful Web Services
  • Contexts and Dependency Injection
  • Dependency Injection for Java
  • Bean Validation
  • JavaMail
  • Java Authentication Service Provider Interface for Containers
  • Security API
  • WebSocket
  • JSON Processing
  • JSON Binding
  • Concurrency Utilities
  • Batch Applications

Java SE APIs that are required by the Java EE 8:

  • JDBC
  • JNDI
  • JavaBeans Activation Framework
  • Java API for XML Processing
  • Java Architecture for XML Binding
  • Java API for XML Web Services
  • SOAP with Attachments API for Java
  • Java Authentication and Authorization Service
  • Common Annotations for the Java Platform

Resource Creation

Resources and JNDI Naming

In the Java EE platform a distributed application components uses uses JNDI naming service to access other components and resources, such as databases. A resource is a program object that provides connections to systems, such as data sources and messaging systems, identified by a JNDI name.

DataSource Objects and Connection Pools

Java EE components may access relational databases through the JDBC API, using DataSource objects.

Applications access a data source by using a connection, and a DataSource object can be thought of as a factory for connections to the particular data source that the DataSource instance represents. In a basic DataSource implementation, a call to the getConnection method returns a connection object that is a physical connection to the data source.

A DataSource object may be registered with a JNDI naming service. If so, an application can use the JNDI API to access that DataSource object, which can then be used to connect to the data source it represents.


Archive Name File Extension
Enterprise application .ear .jar .war
EJB archive .jar .war
Web archive .war
Resource Adapter .rar
Enterprise application

An enterprise application is a collection of web applications, EJBs, and resource adaptors. It makes deployment easier by allowing you to deploy one element that contains many separate entities. Using JAR, WAR, and EAR files and modules makes it possible to assemble a number of different Java EE applications using some of the same components.

An EAR file contains Java EE modules and, optionally, deployment descriptors. A deployment descriptor, an XML document, that describes the deployment settings of an application, a module, or a component. Because deployment descriptor information is declarative, it can be changed without the need to modify the source code. At runtime, the Java EE server reads the deployment descriptor and acts upon the application, module, or component accordingly. Each deployment unit has a standard deployment descriptor:

  • Web application: web.xml
  • Web service: webservices.xml
  • EJBs: ejb-jar.xml
  • Resource adapter: ra.xml
  • Enterprise application: application.xml

Deployment information is most commonly specified in the source code by annotations. Deployment descriptors, if present, override what is specified in the source code. The two types of deployment descriptors are::

  • A Java EE deployment descriptor is defined by a Java EE specification and can be used to configure deployment settings on any Java EE implementation.
  • A runtime deployment descriptor is used to configure Java EE implementation-specific parameters.

A Java EE module consists of one or more Java EE components for the same container type and, optionally, one component deployment descriptor of that type. A Java EE module can be deployed as a stand-alone module.

The EAR structure

 ├─Web module # contain servlet class files, web files, supporting class files, and optionally, a web application deployment descriptor, packaged as JAR files with a .war extension
 ├─EJB modules # contain class files for enterprise beans and, optionally, an EJB deployment descriptor, packaged as JAR files with a .jar extension.
 ├─Application client modules # contain class files and, optionally, an application client deployment descriptor, packaged as JAR files with a .jar extension.
 └─Resource adapter modules # contain all Java interfaces, classes, native libraries, and, optionally, a resource adapter deployment descriptor. Together, these implement the JCA for a particular EIS, packaged as JAR files with an .rar extension.

To assemble a Java EE application, package one or more modules, such as EJB JAR files, into an EAR file, the archive file that holds the application. When deploying the EAR file that contains the enterprise bean’s EJB JAR file, you also deploy the enterprise bean to GlassFish Server.

EJB archive

Can be packaged in EJB JAR or WAR modules:

  • An EJB JAR file is portable and can be used for various applications.
  • The WAR module simplifies deployment and application organization. Enterprise beans may be packaged within a WAR module as class files or within a JAR file that is bundled within the WAR module.

The JAR structure

 | └─ejb-jar.xml  # and other file descriptors
 └─.class files
Web archive

A web module is the smallest deployable and usable unit of web resources. A web module contains web components and static web content files, which are called web resources.

The WAR structure

 | ├─classes # a directory that contains server-side classes: servlets, enterprise bean class files, utility classes, and JavaBeans components
 | ├─lib # a directory that contains JAR files that contain enterprise beans, and JAR archives of libraries called by server-side classes
 | └─web.xml # and other file descriptors
 └─Web pages
Resource Adapter

A Resource Adapter Archive (RAR) file stores XML files, Java classes, and other objects for JCA applications. A resource adapter can be deployed on any Java EE server, or a Java EE application. A RAR file can be contained in an EAR file, or it can exist as a separate file.

Learn more in the Java EE documentation


Leave a Comment