blogger templates blogger widgets
This is part of a list of blog posts.
To browse the contents go to

Introduction to JNDI

Understanding the key terminologies will help to understand how JNDI works

Naming Service

A fundamental facility in any computing system is the naming service--the means by which names are associated with objects and objects are found based on their names. When using almost any computer program or system, you are always naming one object or another. For example,
To access a file in the computer, you must supply its name.

A naming service's primary function is to map people-friendly names to objects, such as addresses, identifiers, or objects typically used by computer programs. For example, the Internet Domain Name System (DNS) maps machine names (such as to IP addresses (such as A file system maps a filename (for example, c:\bin\autoexec.bat) to a file handle that a program can use to access the contents of the file.

Naming Convention

To look up an object in a naming system, you supply it the name of the object. The naming system determines the syntax that the name must follow. This syntax is sometimes called the naming system's naming convention.


The association of a name with an object is called a binding. For example, a file name is bound to a file.

References and Addresses

Depending on the naming service, some objects cannot be stored directly; that is, a copy of the object cannot be placed inside the naming service. Instead, they must be stored by reference.
A reference is information about how to access an object.
A file object, for example, is accessed using a file reference, also called a file handle.


A context is a set of name-to-object bindings. Every context has an associated naming convention. A context provides a lookup (resolution) operation that returns the object and may provide operations such as those for binding names, unbinding names, and listing bound names. More about Context later.

Naming Systems and Namespaces

A naming system is a connected set of contexts of the same type (they have the same naming convention) and provides a common set of operations.
A naming system provides a naming service to its customers for performing naming-related operations.

A naming service is accessed through its own interface.

For example,
- the DNS offers a naming service that maps machine names to IP addresses.
- LDAP offers a naming service that maps LDAP names to LDAP entries.
- file system offers a naming service that maps filenames to files and directories.

A namespace is the set of names in a naming system. For example, the UNIX file system has a namespace consisting of all of the names of files and directories in that file system. The DNS namespace contains names of DNS domains and entries. The LDAP namespace contains names of LDAP entries.

Directory Service

Many naming services are extended with a directory service. A directory service associates names with objects and also allows such objects to have attributes. Thus, you not only can look up an object by its name but also get the object's attributes or search for the object based on its attributes.


The Java Naming and Directory InterfaceTM (JNDI) is an application programming interface (API) that provides naming and directory functionality to applications written using the JavaTM programming language.

Note that when we say JNDI or JNDI API we mean all the 3 together: JNDI API, Naming Manager, JNDI SPI.

The orange blocks that you see are the service providers. We would need individual service provider for each service.
For eg: To connect to LDAP server using JNDI calls we would need a LDAP service provider.

Continue reading: Prerequisites

No comments:

Post a Comment