Available since OmniFaces 3.9

JNDIObjectLocator is used to centralize JNDI lookups. It minimizes the overhead of JNDI lookups by caching the objects it looks up.

Implements the ServiceLocator design pattern.

Major features are:

  • thread-safe
  • immutable
  • serializable
  • selectively disables the cache if objects are remote


locator = JNDIObjectLocator.builder().build();
MyEJB myEJB1 = locator.getObject(MyEJB.class);
MyEJB myEJB2 = locator.getObject("java:module/MyEJB");

Example Code (GitHub)

Documentation & Sources