Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

JNDI overview, Part 1: An introduction to naming services

Use JNDI to better manage your distributed applications

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Those of you who've been to a library and can still remember the experience may recall the process of locating a library book. If you aren't in touch with your antiquarian side, this situation will seem unfamiliar; but every once in a while I wander off to a local library to look for a genuine, offline book. Libraries are filled with thousands of the things -- they're dusty and made of wood pulp and cow hide, but they're fascinating in their own way. In any event, when the compulsion to find a certain one strikes, I avoid the naive course of walking up and down the library aisles searching for it and turn instead to the card catalog.

TEXTBOX: TEXTBOX_HEAD: JNDI overview: Read the whole series!

A card catalog, for the uninitiated, maps the names of books to their location in the library. By going to the card catalog first and looking up the book's location, I save myself a significant amount of walking. (Incidentally, I've heard that some libraries actually allow patrons to use computers instead of the card catalog. They've got it half right -- now if they'll just put the information in the books into the computer where it belongs...)

As surprising as it may seem, the notion of a card catalog is quite handy in the world of computing, as well. In computing, we call it a naming service, which associates names with the locations of services and with information. It provides computer programs with a single location where they can find the resources they need. In the way, programs don't waste time by performing the electronic equivalent of walking up and down the aisles, and don't require that the locations be hardcoded into their logic, either.

Finding resources is of particular importance in large-scale enterprise environments, where the applications you build may depend on services provided by applications written by other groups in other departments. A well-designed naming infrastructure makes such projects possible -- and the lack of one makes them impossible. In fact, many business-process reengineering efforts begin with the design and implementation of a robust, enterprise-wide naming and directory infrastructure.

This month, I introduce the Java Naming and Directory Interface (JNDI). JNDI provides a common-denominator interface to many existing naming services. As such, JNDI was not designed to replace existing technology; instead, it provides a common interface to existing naming services. Let's begin by taking a look at some of these services.

An introduction to naming services

The figure below depicts the organization of a generic naming service.

A generic naming service

A naming service maintains a set of bindings. Bindings relate names to objects. All objects in a naming system are named in the same way (that is, they subscribe to the same naming convention). Clients use the naming service to locate objects by name.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comments (6)
Login
Forgot your account info?

Good explanation! Thanks a lotBy Anonymous on October 13, 2009, 3:07 amGood explanation! Thanks a lot

Reply | Read entire comment

Naming Service + JNDIBy Anonymous on October 5, 2009, 9:10 amExcellent analogy. Great description for non-developers.

Reply | Read entire comment

Great ExplanationBy Anonymous on June 7, 2009, 1:55 amIt's really great explanation, the way Todd explained is really awesome,,Really its make the things easier. Thanks for this kind of explaination

Reply | Read entire comment

JNDIBy Anonymous on June 2, 2009, 3:41 pmVery nicely explained! Good article... Congrats Todd!

Reply | Read entire comment

Information belongs in a computerBy Anonymous on March 19, 2009, 5:19 pmHardcopy lacks some important capabilites such as efficient search. Electronic storage of text has shortcomings as well. While I think it is wise to electronically...

Reply | Read entire comment

View all comments

Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources