|
|
|
||||||||||||||||
|
|||||||||||||||||
JNDI: How do I learn JNDI? Java's Registry backbone.. Updated Sep 7, 2000
| Overview Tutorials Examples Service Providers Advanced Vendor Specific Book References |
|
See also JNDI
FAQ Sun: JNDI service providers and Java Skyline: Enterprise Learn EJB |
||||
| Java Naming and Directory Services (JNDI) provides a way of connecting to
various kinds of services that are indexed in a registry. JNDI is modeled on LDAP (Lightweight Directory Access
Protocol and usually associated with LDAP. But importantly, JNDI also forms the backbone of other important APIs, including RMI, EJB, JMS, and CORBA. For an overview of JNDI see Java™ Naming and Directory Interface (JNDI): A More Open and Flexible Model by Richard Monson-Haefel, Java Report Online Feb 1998. For an overview with a lookup example see: JNDI overview, Part 1: An introduction to naming services by Todd Sundsted, JavaWorld, Jan 2000. LDAP is defined in IETF RFC 2251. For a comparision of LDAP and JNDI see: Comparison of the LDAP and JNDI Models from the JNDI Tutorial. With JNDI, you can connect to existing registries such as RMI or an LDAP application. JNDI provides searching and connection capabilities that enable you to find and communcate with remote objects. You can also use JDNI to create your own registries. |
||||||
|
|
||||||
| The JNDI Tutorial by Rosanna Lee, Sun. Tod Sundsted's second JavaWorld article on JNDI JNDI overview, Part 2 explains searching plus using the bind(), getAttribute() and other JNDI methods. |
||||||
| Simple
name lookup from the JNDI Tutorial, Rosanna Lee, Sun. Also Making
Enterprise Connections with JNDI and LDAP by Scott Grant &
Joseph Campolongo, Java Pro Dec 1999. The Sun JNDI examples page shows short
JNDI code segments and refers to the "JNDI demo program" - an interactive browser example you get when
you download JNDI. Attribute retrieval from a directory from the JNDI Tutorial, Rosanna Lee, Sun. Sun JNDI examples. |
||||||
| JNDI can be implemented in almost any hierarchial naming structure. An implementation of JNDI for a particular environment is called a Service Provider. And to use JNDI in a particular environment you need the Service Provider for that environment. Here are articles and service provider resources for particular environments: | ||||||
| CORBA | Reference: COS Naming Service Provider for the Java Naming and Directory Interface (JNDI) Sun JDK 1.3 Docs. Example: Locating CORBA objects using Java IDL by Andy Krumel, JavaWorld, Feb 1999. |
|||||
| J2EE and EJB | JNDI is used extensively in J2EE servers and is the main glue that connects
to EJB containers. The
Use of JNDI in Enterprise Java APIs by Ian Moraes, JDJ Aug 2000,
provides a good overview and also see What are Enterprise JavaBean Components?
by Ken Norby, developerWorks, June 2000. You can use JNDI to retrieve the EJBContext for EJB 1.1 see: Create forward-compatible beans in EJB, Part 1, Page 2, Listing 3B by Richard Monson-Haefel JavaWorld, Dec 1999. |
|||||
| RMI | The RMI Registry SPI provides limited functionality for JNDI. Reference: RMI Registry
Service Provider for the Java Naming and Directory Sun Highly Recommended*** However, for a more robust implementation see Rikard Oldberg's Java Naming Provider (JNP) on Dreambean.com. Unlike the RMI SPI, JNP provides a hierarchial name space. The download package, jnp02.zip includes a sample program and is relatively easy to set up and use. |
|||||
| LDAP |
Using JNDI with an existing LDAP Server:
Obtaining an LDAP Server:
You may wish to set up your own LDAP server. Note, you absolutely *must* have an LDAP server to use JNDI-LDAP.
You can obtain a freeware (Unix based) LDAP from the OpenLDAP
project. For Windows, see the Eudora LDAP Directory Server (you
need to compile it - so you will need Visual C++). Or check for one in Sun's list of JNDI service providers. |
|||||
| DSML(XML) and DNS |
Java Naming and Directory Interface (JNDI) DSML and DNS Service Provider 1.2 Technology Preview Releases JDC -requires registration | |||||
| Windows Registry |
Cogent Logic's product called JNDI for Windows, is a JNDI service provider that enables access to the Windows registry via JNDI. The Windows Registry Service Provider will operate on the 2000/NT/XP, ME/9x versions of Windows. | |||||
| Within your application, you can greatly simplify using JNDI by treating aregistry as a HashTable see: Use JNDI to share objects between different virtual machines by Thomas E. Davis JavaWorld, Jul 1999. In the March edition of JavaWorld, the third in Tod Sundsted's JNDI series Advanced JNDI covers using a registry with JNDI to store objects using serialization and by reference. | ||||||
| BEA Weblogic | Using Weblogic JNDI | |||||
| Netscape LDAP | Using the JNDI Service Provider Netscape Directory SDK 4.0 for Java Programmer's Guide, Chapter 15. | |||||
| Professional
Java Server Programming by Andrew Patzer, WROX, 1999 Java Enterprise in a Nutshell by William Crawford and Jim Farley, O'Reilly 1999 The JNDI API Tutorial and Reference by Rosanna Lee and Scott Seligman, Addison Wesley 2000 |
||||||
|
|
||||||