[an error occurred while processing this directive]

Java Naming and Directory Interface (JNDI)


The Java Naming and Directory Interface (JNDI) is a directory service based API to allow the clients to discover and lookup data and objects via a name. JNDI is independent of the underlying implementation similar to all Java APIs that interface with host systems. Moreover, it indicates a service provider interface (SPI) that allows directory service implementations plugged into the framework. Vendor is free to choose either for a server or for a flat file or for a database for implementation.

RMI and Java EE uses the JNDI API to lookup the objects in a network. E.g. Jini does not use the JNDI API and has its own lookup service. 

The API provides:

  • a mechanism that binds up an object with a name.
  • a directory lookup interface to allow general queries
  • an event interface to allow clients that determines when directory entries have been modified
  • LDAP extensions of an LDAP service for supporting additional capabilities.

The SPI portion supports any kind of practical naming or directory services including:

JNDI hierarchally organizes its name, these name can be any string type like "com.mydomain.ejb.MyBean" or it can also be object name that supports the Name interface, but string is the most common way to naming an object. An object is associated with a name in the directory either by storing the object or a reference to the object in the directory service identified by the name.

The JNDI API defines a context indicating the location to look for an object. The initial context is mainly used as a starting point.



[an error occurred while processing this directive]