The regular Home Interface uses RMI-IIOP for network communication—even when the client and bean are in the same JVM. This adds unnecessary overhead (serialization, network stack) for local calls.
The Local Home Interface (javax.ejb.EJBLocalHome) is the high-performance version of the Home Interface. It’s used when the client and bean are in the same JVM—no network calls, no RemoteException, direct memory access.
- Extends
EJBLocalHome: Unlike regular Home which extendsEJBHome(which extendsjava.rmi.Remote) - No
RemoteException: Since there’s no network call, there’s no possibility of network failure - Returns Local Interface:
create()returnsHelloLocal(local interface), not remote - Fast: Uses pass-by-reference semantics within the same JVM
- No
RemoteException: Cleaner method signatures - Pass-by-reference: Parameters passed directly (not serialized)
- Faster: No RMI-IIOP overhead
- Same JVM requirement: Cannot be used for remote clients
- Built from: Home Interface (remote version)
- Builds into: Remote Interface (contrast: remote has network overhead)
- Related: EJB Object, Session Bean
- Contrasts with: Home Interface (remote, has
RemoteException)
- Mixing local and remote: If you look up a LocalHome via JNDI from a remote client, you’ll get an error
- ClassLoader issues: In same JVM but different ClassLoaders can still cause problems
- Transaction propagation: Local calls propagate transactions automatically (unlike remote which may require distributed transactions)
public interface HelloLocalHome extends javax.ejb.EJBLocalHome {
HelloLocal create() throws javax.ejb.CreateException;
// Note: No RemoteException!
}