Java Naming and Directory InterfaceTM (JNDI) 1.2
Optional Package


Please send feedback to jndi@java.sun.com

Table of Contents


Introduction

This document describes how to use the JNDI 1.2 Optional Package with the Java 2 SDK, Standard Edition, v 1.2.x, and the JDK 1.1.x. See the JNDI Tutorial for detailed descriptions and examples.


Java 2 SDK, Standard Edition, v 1.2.x

Software Dependencies

Software Installation

  1. Unzip the distribution file to get a lib directory.
  2. If you are using JNDI as an installed extension, copy the jndi.jar file from the lib directory to the $JAVA_HOME/jre/lib/ext directory.
  3. If you are not using JNDI as an installed extension, copy the jndi.jar file to its permanent location and add its location to your classpath.

Security Considerations

When a Reference is read from the naming or directory service and a codebase specifying where to load the factory class for the reference has been specified, JNDI will attempt to load the class from the locations specified in code base. In order for the class loading to succeed, you must grant the application the permissions appropriate for the URLs named in the codebase. For example, if the URL scheme is "http" or "ftp", you must grant the application the appropriate java.net.SocketPermission; if the URL scheme is "file", you must grant the application the appropriate java.io.FilePermission.

If you are using JNDI as an installed extension, that is, jndi.jar has been installed in the $JAVA_HOME/jre/lib/ext directory, you need to take no further action.

Otherwise, you must grant the following permissions to jndi.jar:

permission java.util.PropertyPermission "java.naming.factory.initial", "read";
permission java.util.PropertyPermission "java.naming.factory.object", "read";
permission java.util.PropertyPermission "java.naming.factory.url.pkgs", "read";
permission java.util.PropertyPermission "java.naming.factory.state", "read";
permission java.util.PropertyPermission "java.naming.factory.control", "read";
permission java.util.PropertyPermission "java.naming.provider.url", "read";
permission java.util.PropertyPermission "java.naming.dns.url", "read";
permission java.io.FilePermission "${jndi.home}${/}lib${/}*", "read";
You must also grant the permissions required for class loading described above to jndi.jar.

In addition, you must grant the following permission jndi.jar if the application/applet code is loaded using a different classloader than the one that loaded jndi.jar. If the application/applet code is in the same classpath as jndi.jar, then you do not need to do this.

permission java.lang.RuntimePermission "getClassLoader";

JDK 1.1.x

Software Dependencies

Software Installation

  1. Unzip the distribution file to get a lib directory.
  2. Copy the jndi.jar from the lib directory to its permanent location.
  3. Add the location of the jndi.jar to your classpath.

Security Considerations

When a Reference is read from the naming or directory service and a codebase specifying where to load the factory class for the reference has been specified, JNDI will attempt to load the class using the RMIClassLoader. In order for the class loading to succeed, the application must have installed a security manager. For example, you can install the RMISecurityManager as follows:
System.setSecurityManager(new java.rmi.RMISecurityManager());


Copyright © 1999 Sun Microsystems, Inc., All Rights Reserved.