Distributed Objects   «Prev  Next»

Lesson 1

Distributed Objects, Enterprise Beans, and Jakarta EE 11

This module introduces distributed objects and explains how Enterprise JavaBeans, now Jakarta Enterprise Beans, fit into the history of enterprise Java. Older enterprise systems often tried to make remote software components behave like local objects. A client could call a method on an object-like component, while middleware handled the network communication, object lookup, lifecycle rules, security checks, transaction boundaries, and failure handling.

Before J2EE became widely adopted around 2000, several middleware technologies influenced this style of architecture. CORBA, DCOM, and Java RMI all tried to solve the problem of invoking behavior across process, machine, or network boundaries. Enterprise JavaBeans adopted many of those distributed-object ideas for Java enterprise applications by placing business components inside a managed container.

In a modern Jakarta EE 11 application, the same enterprise concerns still exist, but they are usually handled differently. Instead of exposing fine-grained remote objects directly to clients, modern applications commonly use CDI managed beans inside the application, Jakarta RESTful Web Services for HTTP endpoints, JSON payloads for data exchange, Jakarta Persistence for database access, Jakarta Transactions for transaction control, Jakarta Security for authentication and authorization, and Jakarta Messaging for asynchronous communication.

What Distributed Objects Tried to Solve

A distributed object is an object-like component whose methods can be invoked by a client even though the component may be running in another process, JVM, server, or network location. The goal was to let programmers work with remote services using a familiar object-oriented programming model.

This idea was attractive because enterprise systems needed shared business logic. A customer-management system, inventory service, billing engine, or order processing component might need to be used by multiple applications. Instead of copying business logic into every program, developers wanted reusable components that could be deployed once and invoked remotely.

However, remote calls are not the same as local method calls. A local method call happens inside the same process and usually fails in predictable programming ways. A remote call crosses a network boundary. It may involve serialization, authentication, authorization, protocol negotiation, timeout handling, version compatibility, retries, partial failure, and network latency. Treating a remote call as if it were identical to a local call can hide important distributed-system risks.

That is one of the main lessons of this module. Distributed-object technology was important because it helped enterprise developers think about remote components, container services, and server-side business logic. At the same time, modern Jakarta EE design usually makes service boundaries explicit rather than pretending the network does not exist.

Legacy Middleware Before and During Early J2EE

Several technologies shaped the enterprise Java distributed-object model before and during the early J2EE period.

CORBA

CORBA, the Common Object Request Broker Architecture, provided a language-neutral distributed-object model. It allowed components written in different languages to communicate through interfaces described with IDL, or Interface Definition Language. CORBA was powerful because it was designed for heterogeneous enterprise systems, but it was also complex. Developers had to understand object request brokers, generated stubs and skeletons, naming services, IDL contracts, and protocol interoperability.

DCOM

DCOM, the Distributed Component Object Model, extended Microsoft COM across network boundaries. It was important in Windows-centered enterprise environments and allowed software components to communicate remotely. Its strength was tight integration with Microsoft platforms, but that was also a limitation when systems needed broad cross-platform interoperability.


Java RMI

Java RMI, or Remote Method Invocation, allowed Java objects to invoke methods on remote Java objects. RMI was easier to understand in Java-only systems than CORBA because the client and server both used Java interfaces and Java object serialization. However, RMI was still a distributed-object system, so it still had to deal with network failure, remote exceptions, object serialization, lookup, and version compatibility.

EJB and RMI-IIOP

Enterprise JavaBeans brought distributed-object ideas into enterprise Java. Early EJB systems used remote interfaces, home interfaces, deployment descriptors, and container-managed services. RMI-IIOP connected Java remote invocation with CORBA-style interoperability. This was important historically, but it is no longer the usual way to design new Jakarta EE applications.

How EJB Fit the Distributed-Object Model

Enterprise JavaBeans were designed as server-side business components managed by an EJB container. The developer wrote business logic inside a bean class, and the container supplied infrastructure services around that business logic.

The EJB container handled many concerns that would otherwise have required custom infrastructure code. These services included lifecycle management, dependency injection, declarative transactions, security checks, pooling, concurrency control, interceptors, timers, remote invocation, and integration with persistence or messaging systems.

This created a contract between the bean, the client, and the container. The bean developer followed the programming rules of the EJB model. The client used a business interface or lookup mechanism to invoke the component. The container managed the surrounding system services. In older enterprise Java courses, this container contract was sometimes described as the "plumbing" supplied by the EJB server.

That contract is still worth understanding. Modern Jakarta EE applications may use CDI, REST, persistence, transactions, and security more often than remote EJB interfaces, but the basic idea remains: enterprise developers should focus on business logic while the runtime provides common services such as injection, security, transactions, validation, and request processing.


Jakarta Enterprise Beans in the Modern Platform

The term Enterprise JavaBeans belongs to the older Java EE naming era. In the Jakarta EE world, the technology is known as Jakarta Enterprise Beans. Jakarta EE 11 continues to include Enterprise Beans 4.0, while the platform has also moved strongly toward CDI as the central component model. The Jakarta EE 11 release page also notes that the older Managed Beans specification was removed and replaced by CDI alternatives. :contentReference[oaicite:2]{index=2}

This distinction matters for a course under cdi-managed-beans. Modern Jakarta EE developers should understand EJB history, but they should not assume that every business component must be implemented as a remote Enterprise Bean. Many applications now use CDI managed beans as the default application component model and use Jakarta Enterprise Beans only when a specific Enterprise Beans service is appropriate.

Jakarta Enterprise Beans still preserves important enterprise ideas, especially session beans, container-managed transactions, interceptors, timers, and integration with the Jakarta EE runtime. However, the architectural center of gravity has moved away from fine-grained distributed objects and toward explicit service interfaces, REST endpoints, JSON payloads, messaging, and CDI-managed application services.

Types of Enterprise Beans: Historical and Modern View

Older EJB courses often introduced stateful session beans, stateless session beans, singleton session beans, entity beans, and message-driven beans. That list needs careful modernization.

A stateless session bean represents business logic that does not maintain conversational client state between method calls. Stateless components are useful for scalable service operations because the container can pool instances and reuse them across requests.

A stateful session bean maintains client-specific conversational state across multiple method calls. This model can be useful in specialized workflows, but modern web and service architectures often prefer explicit state management through databases, sessions, tokens, or client-visible workflow data.


A singleton session bean represents one shared component instance in the application. It can be used for shared services, initialization logic, or coordinated access to application-wide resources when the container-managed singleton model is appropriate.

A message-driven bean is associated with asynchronous messaging. Rather than being invoked directly by a remote client, it reacts to messages from a messaging provider. This remains conceptually relevant because asynchronous messaging is still important in enterprise integration.

An entity bean, however, is legacy. Entity beans should not be presented as the modern persistence model. In modern Jakarta EE applications, persistent domain data is represented with Jakarta Persistence entities, repositories, DAOs, or persistence services. Jakarta Persistence 3.2 is part of the Jakarta EE 11 technology set and is the modern successor for the persistence responsibilities that older courses often associated with entity beans. :contentReference[oaicite:3]{index=3}

Legacy Concepts and Jakarta EE 11 Equivalents

The most useful way to modernize this module is to map older distributed-object ideas to the Jakarta EE 11 technologies that now address similar architectural concerns.

Legacy distributed-object concept Modern Jakarta EE 11 equivalent
Remote EJB method calls Jakarta RESTful Web Services, HTTP APIs, DTOs, JSON-B, and JSON-P
CORBA and RMI-IIOP interoperability REST APIs, JSON payloads, OpenAPI-style service contracts, and explicit integration endpoints
Java RMI remote objects REST services, messaging, or explicitly designed service clients
Entity beans Jakarta Persistence entities, repositories, and persistence services
Deployment descriptors as the primary configuration mechanism Annotations, CDI configuration, build tools, and optional descriptors when needed
EJB container lifecycle services CDI scopes, lifecycle management, interceptors, and Enterprise Beans services where appropriate
EJB container-managed transactions Jakarta Transactions with declarative transaction boundaries
EJB security roles Jakarta Security, container security, identity stores, and authorization rules
Remote object references Service endpoints, clients, DTOs, and JSON payloads
Synchronous fine-grained remote calls Coarse-grained REST operations, asynchronous messaging, events, and queue-based designs
Object monitor or container plumbing Jakarta EE runtime services: CDI, transactions, security, persistence, messaging, validation, and concurrency


This mapping does not mean that every older idea was wrong. It means that modern enterprise Java exposes the system boundary differently. Instead of pretending that remote objects are local objects, Jakarta EE 11 applications usually define visible service contracts and pass data across those contracts deliberately.

CDI Managed Beans in the Modern Model

CDI, Contexts and Dependency Injection, is central to the modern Jakarta EE programming model. CDI managed beans provide type-safe dependency injection, scopes, lifecycle management, qualifiers, producers, events, interceptors, and integration with other Jakarta EE services. CDI 4.1 is part of Jakarta EE 11, and its release notes describe changes that improve modularity by delegating integration requirements to the Jakarta Platform specifications. :contentReference[oaicite:4]{index=4}

A CDI managed bean is not automatically a distributed object. It is usually an application component managed inside the application boundary. It may be injected into a REST resource, a persistence service, a validation component, or another business service. CDI helps assemble the application internally.

When the application needs to communicate with the outside world, that boundary is usually exposed through an explicit technology. For example, a CDI service may be called by a Jakarta REST resource, which receives an HTTP request and returns JSON. The REST resource becomes the remote boundary, while CDI manages the business components inside that boundary.

Jakarta REST and JSON as the Modern Remote Boundary

Modern distributed systems usually avoid hiding the network behind fine-grained method calls. Instead, they expose service capabilities through explicit interfaces such as HTTP endpoints, JSON documents, asynchronous messages, or event streams.

Jakarta RESTful Web Services provides the Jakarta EE API for building REST-style web services. In a modern design, a class annotated as a REST resource receives HTTP requests, delegates business work to CDI-managed services, and returns responses with appropriate data and status codes. JSON-B can bind Java objects to JSON, while JSON-P provides lower-level JSON processing when more control is needed.

This design makes the remote boundary visible. A client does not pretend it is calling a local object. It sends a request to a service endpoint and receives a response. The service contract is clearer, the network boundary is explicit, and the application can be designed around HTTP semantics, DTOs, authentication, authorization, validation, and failure handling.

Transactions, Security, and Reliability

One of the strengths of EJB was that it made enterprise services available declaratively. A developer could apply transaction and security rules without writing all of the infrastructure code manually. Modern Jakarta EE preserves that basic value, but distributes the responsibility across several specifications.

Jakarta Transactions provides transaction boundaries. Jakarta Security provides authentication and authorization support. Jakarta Persistence handles database mapping and persistence operations. Jakarta Messaging supports asynchronous integration. Jakarta Concurrency provides managed concurrent execution. Jakarta Bean Validation supports declarative validation of input and domain objects.

Distributed transactions require special caution. In older enterprise systems, broad two-phase commit transactions across multiple resources were often treated as the ideal solution for consistency. Modern systems often prefer narrower local transactions, reliable messaging, idempotent operations, eventual consistency, and compensating actions. The right strategy depends on the business requirement, but modern design should not assume that every distributed operation belongs inside one large remote transaction.

Deployment and Packaging

Older EJB applications often depended heavily on deployment descriptors and EJB JAR packaging. A deployment descriptor described the structure of an Enterprise Bean and supplied runtime configuration. JAR files packaged Java classes and metadata for deployment.

Modern Jakarta EE applications still use standard packaging, but the style has changed. WAR files are common for web applications. JAR files are used for libraries and application components. EAR files still exist, especially in larger or legacy enterprise deployments, but many modern applications are packaged more simply.

Annotations are now the primary way to express many application rules. A Jakarta EE application may use annotations such as @ApplicationScoped, @Inject, @Path, @Entity, @Transactional, and interceptor bindings. Configuration files and descriptors are still useful in some cases, but they are no longer the first concept a student should associate with enterprise component development.

What This Module Will Cover

This module uses Enterprise Beans and distributed objects as a bridge between older enterprise Java architecture and modern Jakarta EE 11 design. You will see why EJB mattered, what problems it tried to solve, and how its container-managed services influenced the platform.

You will also learn why many of the older distributed-object mechanisms are now legacy. CORBA, DCOM, RMI-IIOP, remote object references, and entity beans belong to the historical background of enterprise systems. They help explain where enterprise Java came from, but they should not be presented as the default design model for new Jakarta EE 11 applications.

The modern focus is CDI-managed components, explicit service boundaries, REST endpoints, JSON payloads, persistence services, transaction boundaries, security rules, validation, messaging, and deployment practices that fit current enterprise Java.

Learning Objectives

After completing this module, students should be able to:

  1. Define distributed objects in the context of enterprise Java history.
  2. Explain why CORBA, DCOM, Java RMI, and EJB were important middleware technologies.
  3. Describe how EJB remote interfaces related to distributed-object programming.
  4. Explain why remote method calls are not the same as local method calls.
  5. Identify the container services historically provided by EJB.
  6. Distinguish stateless session beans, stateful session beans, singleton session beans, message-driven beans, and legacy entity beans.
  7. Explain why entity beans were replaced by Jakarta Persistence entities.
  8. Map legacy distributed-object concepts to Jakarta EE 11 technologies.
  9. Explain the modern role of CDI managed beans.
  10. Describe how Jakarta REST, JSON-B, JSON-P, and DTOs replace many remote-object use cases.
  11. Explain how Jakarta Transactions, Jakarta Security, Jakarta Persistence, Jakarta Messaging, and Jakarta Concurrency support enterprise requirements.
  12. Describe why modern service boundaries should be explicit rather than hidden behind fine-grained remote object calls.

Summary

Enterprise JavaBeans were historically important because they brought distributed-object ideas, server-side business components, and container-managed services into enterprise Java. EJB helped developers build scalable business applications by relying on a container for lifecycle management, transactions, security, remote invocation, and deployment infrastructure.

In Jakarta EE 11, those enterprise concerns still matter, but the architectural style has changed. Modern Jakarta EE applications usually use CDI managed beans inside the application, Jakarta RESTful Web Services at the remote boundary, JSON for data exchange, Jakarta Persistence for database work, Jakarta Transactions for transaction control, Jakarta Security for access control, and Jakarta Messaging for asynchronous integration.

The purpose of this module is to preserve the important lessons of distributed objects while updating the implementation model. Students should understand the legacy technologies that led to EJB, but they should also recognize that modern Jakarta EE favors explicit service boundaries, CDI-based composition, REST and JSON integration, and persistence services over fine-grained remote object programming.


SEMrush Software