A simple, educational example of using Enterprise JavaBeans (EJB) and Java Naming and Directory Interface (JNDI) with Jakarta EE and GlassFish. This project demonstrates how multiple standalone clients can interact with a shared EJB and access a common JNDI registry.
Java-EJB-JNDI/ βββ EE-WebApp/ # EJB module (remote business logic)
βββ EE-Client-App/ # Client #1 - performs remote EJB call and binds data
βββ EE-Client-App2/ # Client #2 - retrieves shared data from JNDI
- β Java 11
- π Jakarta EE 10
- π¦ EJB (Enterprise Java Beans)
- π§ JNDI (Java Naming and Directory Interface)
- π¬ GlassFish 7.0.21 (remote + embedded)
- π Maven
- π Purpose: Hosts remote business logic via a remote interface.
- π§ͺ Implements:
UserDetailsBean(an EJB) - π Exposes:
UserDetailsinterface using@Remote - π Deployment: Build and deploy
.jarto GlassFish
- π Performs: JNDI lookup of the
UserDetailsEJB - π§ Retrieves: User's name from the remote bean
- π Binds:
"AppName"string to JNDI for other clients to use
- π Looks up:
"AppName"from the JNDI context - π€ Reads and Prints: Shared string set by Client #1