Distributed Objects   «Prev  Next»

Lesson 10Jakarta EE 11 Managed Components Conclusion
ObjectiveSummarize how Jakarta EE 11 replaces legacy distributed-object assumptions with explicit service boundaries and container-managed components.

Module 3 Conclusion: Managed Components in Jakarta EE 11

This module began with distributed objects and ended with a modern Jakarta EE 11 delivery workflow. The historical goal was reasonable: place reusable business logic on a server and let clients invoke it while middleware supplies networking, security, transactions, lifecycle management, and resource access. The weakness was the assumption that a remote call could look and behave like an ordinary local method call.

Modern Jakarta EE keeps the useful part of that architecture, which is managed server-side components, while making system boundaries clearer. CDI managed beans organize application logic inside a deployment. Jakarta Enterprise Beans supplies specialized services such as session beans, message-driven beans, timers, asynchronous execution, and container-managed transactions. Jakarta RESTful Web Services and messaging expose deliberate integration boundaries. Jakarta Persistence manages durable domain state. The runtime coordinates these technologies through standard contracts.

From Distributed Objects to Explicit Service Boundaries

A local method call is fast, in-process, and governed by one memory model. A remote interaction crosses a process or network boundary. It can fail because of latency, timeouts, unavailable services, authentication, incompatible versions, serialization, or partial completion. CORBA, DCOM, Java RMI, and early remote Enterprise Beans tried to hide much of that difference behind object-like interfaces.

The historical technologies remain useful context, but they are not the default architecture for a new Jakarta EE 11 application. Current systems commonly use HTTP endpoints, JSON representations, asynchronous messages, and coarse-grained service operations. These mechanisms make the boundary visible, give clients an explicit contract, and encourage developers to design for retries, idempotency, versioning, and failure.



Legacy assumptionJakarta EE 11 design directionReason
A remote object should feel local.Use an explicit REST, messaging, or documented service boundary.Network latency and failure remain visible design concerns.
Business components must expose remote object interfaces.Keep most application collaboration local and expose only intentional endpoints.Local component calls are simpler and less tightly coupled.
Persistent records are remote entity components.Use Jakarta Persistence entities behind an application service.Persistence objects model durable data without becoming remotely shared objects.
XML describes every component.Use annotations and defaults, with optional descriptors where overrides or external assembly are useful.Portable metadata can remain concise while deployment still supports configuration.
Deployment is copying an archive to a server.Build, test, publish, configure, deploy, verify, monitor, and recover through a controlled delivery process.A running service has operational responsibilities beyond installation.

Choose the Component Model Deliberately

CDI managed beans and Jakarta Enterprise Beans are related but not interchangeable labels. CDI is the general component and dependency-injection model for modern Jakarta EE applications. It provides type-safe injection, qualifiers, interceptors, decorators, events, producers, and well-defined scopes. A CDI bean is often the natural home for application services, orchestration logic, adapters, and web-layer collaborators.

Jakarta Enterprise Beans is appropriate when its specific container contract solves a real requirement. Stateless session beans support pooled business services without conversational client state. Stateful session beans preserve a client-specific conversation across calls. Singleton session beans provide one shared component instance with container-managed concurrency options. Message-driven beans consume asynchronous messages without a direct client invocation.

The decision should begin with required behavior, not historical naming. If CDI supplies the lifecycle, injection, and interception model an application needs, adding an Enterprise Bean annotation provides little value by itself. When the application needs Enterprise Beans timers, messaging integration, asynchronous invocation, remote business views, or its transaction and concurrency semantics, an Enterprise Bean can be the clearer choice.


The Container Supplies Managed Services

The container-services lesson showed why managed components matter. Application code declares dependencies and policies; a compatible runtime creates component instances and supplies the surrounding services. Depending on the component type and selected Jakarta EE product or profile, those services can include dependency injection, lifecycle callbacks, scopes, naming, resource injection, transaction coordination, security enforcement, persistence integration, messaging, managed concurrency, interceptors, timers, and Jakarta Bean Validation.

This is an application-to-container contract. The component must follow the rules of its model, and the container must implement the required behavior. The contract allows business code to avoid manually creating infrastructure objects or embedding environment credentials. It does not make architecture automatic. Developers must still choose transaction boundaries, security policies, state ownership, failure behavior, and the granularity of exposed operations.

Container management is most effective when those choices are explicit. A transaction boundary should represent one coherent business operation, not every helper method. Security declarations should protect business capabilities and endpoints, while deployment maps portable roles to real identities. Managed executors should be used instead of creating unmanaged application threads. Messaging should be selected when producers and consumers need temporal decoupling or asynchronous work, with delivery, retry, ordering, and duplicate-handling rules designed deliberately. Jakarta Interceptors and Bean Validation can apply cross-cutting policy consistently, but they should make behavior easier to understand rather than conceal important control flow.

The runtime and client-view diagrams in Lesson 3 reinforce that separation. Clients interact through a published view or endpoint. The container interposes lifecycle and policy services around the managed component. Internal components can collaborate through injection, while external clients cross an explicit protocol boundary.



State Belongs in the Right Place

The session-bean lessons distinguished component instance state from durable business data. A stateless session bean may use fields while processing one invocation, but it does not preserve client-specific conversational state between calls. Its instances can be pooled and reused. A stateful session bean associates conversational state with one client for a bounded interaction and has lifecycle and passivation considerations.

Stateful components remain valid, but they should not become a default substitute for explicit workflow state. Web sessions, signed tokens, databases, caches, and client-visible workflow identifiers may provide clearer recovery and scaling characteristics. Ask how long the state must live, whether it must survive restarts, whether several application instances need it, and how it will be cleaned up. The answer determines whether state belongs in a component instance, a web session, a persistent store, or the client.

Durable domain data belongs in Jakarta Persistence entities, not legacy entity beans. An entity is a lightweight domain object associated with a persistence context. An application service controls how entities are loaded and changed within transaction boundaries. The persistence provider performs object-relational mapping and change detection, while optimistic locking can detect conflicting updates. Entities should generally stay behind the service boundary instead of becoming remotely shared objects.


Package Portable Intent, Configure the Environment

The packaging lesson replaced the old one-descriptor-per-bean model with Jakarta EE 11 deployment units. A WAR can be a complete web application and can include CDI beans, Jakarta REST resources, persistence classes, and Enterprise Beans supported in a web module. A separate JAR can hold a library or an Enterprise Beans module. An EAR groups multiple modules when the application genuinely needs coordinated multi-module deployment.

Annotations, defaults, and optional deployment descriptors describe portable component intent. They can declare components, security roles, transaction behavior, persistence units, resources, and dependencies. Environment-specific values such as production credentials, concrete data-source configuration, certificates, endpoints, and capacity settings should remain outside the portable artifact. The deployer binds the application's logical requirements to the target environment.

Tomcat 11 is an appropriate runtime for applications using its Jakarta web technologies, but it is not a full Jakarta EE 11 Platform implementation. Plain Tomcat does not supply the complete Enterprise Beans container or every integrated Platform service discussed in this module. A project that requires those services should select a compatible Jakarta EE runtime or deliberately assemble and configure the additional libraries it needs without claiming full-platform behavior.


Development and Deployment Are Shared Responsibilities

The final lesson separated specification roles from job titles. An Application Component Provider writes components and portable metadata. An Application Assembler creates coherent, versioned deployment units. A Deployer resolves environment dependencies and releases an artifact to a target runtime. Product, tool, container, server, and system-component providers supply implementations and supporting tools. A System Administrator or modern platform and SRE team maintains runtime health.

One person may perform all these responsibilities in a small project. Larger organizations may divide them among several teams and automate transitions through CI/CD. Automation does not remove ownership. It records and executes decisions about testing, artifact composition, security approval, configuration, deployment, verification, observability, rollback, and recovery.

Module 3 Lesson Map

The module's five modern diagrams occur in Lessons 3, 5, 7, and 8. They support the runtime-contract, session-bean, persistence, and packaging concepts summarized below. The conclusion links to those lessons rather than duplicating every diagram.


LessonTopicEssential takeaway
1Distributed objects and Jakarta EE 11Remote interactions have network semantics and should use explicit boundaries.
2Enterprise Beans versus CDICDI is the general component model; use Enterprise Beans for its specialized services.
3Clients, containers, and runtime contractsClient views and component contracts separate callers, application code, and container services.
4Container servicesThe runtime supplies declared lifecycle, injection, transaction, security, resource, and integration services.
5Session beansSession beans provide managed business components with stateless, stateful, or singleton semantics.
6Stateful and stateless behaviorChoose state ownership and lifetime according to conversation, durability, scaling, and recovery needs.
7Jakarta Persistence entitiesEntities model durable data behind services and transaction boundaries.
8Packaging and descriptorsWAR, JAR, and EAR units carry portable code and metadata; environment bindings remain external.
9Development and deployment responsibilitiesSpecification roles describe contracts and ownership, not a mandatory organization chart.

A Practical Design Checklist

Before selecting a Jakarta EE component or deployment model, ask:

  1. Where is the boundary? Keep in-process collaboration local and make remote HTTP or messaging contracts explicit.
  2. Which component model is sufficient? Begin with CDI and choose Enterprise Beans when its defined services match the requirement.
  3. Who owns state? Separate temporary invocation state, conversational state, cached state, and durable domain data.
  4. What must be transactional? Define a business operation's transaction boundary instead of allowing transactions to emerge accidentally from low-level calls.
  5. Which policies are declarative? Use standard metadata for injection, security, transactions, validation, interceptors, and resources where appropriate.
  6. What belongs outside the artifact? Keep secrets, concrete infrastructure bindings, certificates, and environment capacity in controlled deployment configuration.
  7. What does the runtime actually provide? Match application requirements to Tomcat's web-container capabilities or to a compatible full Jakarta EE product.
  8. How will the service fail and recover? Plan timeouts, retries, idempotency, health checks, monitoring, rollback, and data recovery.

Moving Forward

The durable lesson from distributed objects is not that every business object should be remote. It is that enterprise applications need clear contracts between clients, business logic, infrastructure services, persistence, deployment, and operations. Jakarta EE 11 supplies standard component and container contracts for those concerns while allowing applications to expose modern, explicit service boundaries.

With that architecture in place, the next module can move from concepts to implementation details. Continue to Module 4 to examine client views and stateful session-bean programming.


SEMrush Software