Previous Table of Contents Next


Table 5.16 JNDI Exceptions

EXCEPTION SUPERCLASS DESCRIPTION

Defined in javax.naming

AuthenticationException javax.naming .NamingSecurityException This exception is thrown when an authentication error occurs while accessing the naming or directory service.

AuthenticationNotSupportedException javax.naming.NamingSecurityException This exception is thrown when the particular flavor of authentication requested is not supported.

CannotProceedException javax.naming.NamingException This exception is thrown to indicate that the operation reached a point in the name where the operation cannot proceed any further.

CommunicationException javax.naming.NamingException This exception is thrown when the client is unable to communicate with the directory or naming service.

ConfigurationException javax.naming.NamingException This exception is thrown when there is a configuration problem.

ContextNotEmptyException javax.naming.NamingException This exception is thrown when attempting to destroy a context that is not empty.

InsufficientResourcesException javax.naming.NamingException This exception is thrown when resources are not available to complete the requested operation.

InterruptedNamingException javax.naming.NamingException This exception is thrown when the naming operation being invoked has been interrupted.

InvalidNameException javax.naming.NamingException This exception indicates that the name being specified does not conform to the naming syntax of a naming system.

LimitExceededException javax.naming.NamingException This exception is thrown when a method terminates abnormally due to a user- or system-specified limit.

LinkException javax.naming.NamingException This exception is used to describe problems encountered while resolving links.

LinkLoopException javax.naming.LinkException This exception is thrown when a loop is detected in attempting to resolve a link, or when an implementation-specific limit on link counts has been reached.

MalformedLinkException javax.naming.LinkException This exception is thrown when a malformed link is encountered while resolving or constructing a link.

NameAlreadyBoundException javax.naming.NamingException This exception is thrown by methods to indicate that a binding cannot be added because the name is already bound to another object.

NameNotFoundException javax.naming.NamingException This exception is thrown when a component of the name cannot be resolved because it is not bound.

NamingException java.lang.Exception This is the superclass of all exceptions thrown by operations in the Context and DirContext interfaces.

NamingSecurityException javax.naming.NamingException This is the superclass of security-related exceptions thrown by operations in the Context and DirContext interfaces.

NoInitialContextException javax.naming.NamingException This exception is thrown when no initial context implementation can be created.

NoPermissionException javax.naming .NamingSecurityException This exception is thrown when attempting to perform an operation for which the client has no permission.

NotContextException javax.naming.NamingException This exception is thrown when a naming operation proceeds to a point at which a context is required to continue the operation, but the resolved object is not a context.

OperationNotSupportedException javax.naming.NamingException This exception is thrown when a context implementation does not support the operation being invoked.

PartialResultException javax.naming.NamingException This exception is thrown to indicate that the result being returned or returned so far is partial and that the operation cannot be completed.

ReferralException javax.naming.NamingException This abstract class is used to represent a referral exception, which is generated in response to a referral such as that returned by LDAP v3 servers.

ServiceUnavailableException javax.naming.NamingException This exception is thrown when attempting to communicate with a directory or naming service and that service is not available.

SizeLimitExceededException javax.naming .LimitExceededException This exception is thrown when a method produces a result that exceeds a size-related limit.

TimeLimitExceededException javax.naming .LimitExceededException This exception is thrown when a method does not terminate within the specified time limit.

Defined in javax.naming.directory

AttributeInUseException javax.naming.NamingException This exception is thrown when an operation attempts to add an attribute that already exists.

AttributeModificationException javax.naming.NamingException This exception is thrown when an attempt is made to add, remove, modify an attribute, its identifier, or its values that conflicts with the attribute’s (schema) definition or the attribute’s state.

InvalidAttributeIdentifierException javax.naming.NamingException This exception is thrown when an attempt is made to add or create an attribute with an invalid attribute identifier.

InvalidAttributesException javax.naming.NamingException This exception is thrown when an attempt is made to add or modify an attribute set that has been specified incompletely or incorrectly.

InvalidAttributeValueException javax.naming.NamingException This class is thrown when an attempt is made to add to an attribute a value that conflicts with the attribute’s schema definition.

InvalidSearchControlsException javax.naming.NamingException This exception is thrown when the specification of SearchControls for a search operation is invalid.

InvalidSearchFilterException javax.naming.NamingException This exception is thrown when the specification of a search filter is invalid.

NoSuchAttributeException javax.naming.NamingException This exception is thrown when attempting to access an attribute that does not exist.

SchemaViolationException javax.naming.NamingException This exception is thrown when a method in some ways violates the schema.

Summary

JNDI is a powerful tool in your Java arsenal. It provides a seamless interface for accessing all types of information resources. The benefit of a single API for accessing multiple data sources is that you have less to learn and can even change the data source you are accessing by simply changing the values of a few environment variables. Speed of development and maintenance of your code are thus enhanced.

One consideration is performance of using JNDI rather than a native library for accessing your particular directory or naming service. Consider the performance of the JNDI service provider you are using and keep in mind the effects of network traffic and server performance when determining the causes of any performance issues. Even though performance probably won’t be a reason not to use JNDI, you may need to consider the limits of the JNDI searching facility. You probably don’t need a more sophisticated searching mechanism for a naming and directory service than the ones provided with JNDI, but if you do, this may be a limitation of JNDI that you have to work around.

You need to be aware of the security issues for the environment in which your program will run. For example, if you want to create an applet and allow it to connect to directory server running on another machine, you probably need to sign both your applet and all the JNDI-related jar files that your applet will use. The documentation for your service provider should discuss any specific issues for that provider. Also, read the documentation for your service provider to determine which, if any, of the security-oriented properties can be used and the effects of using them.

Remember that it is up to the service providers to support various capabilities of the JNDI. Make sure you carefully read the documentation that comes with the service provider package to see what features are enabled and what security considerations are handled. For example, the file system provider from Sun supports only naming services. The LDAP provider allows you to serialize objects, but others may not. The RMI provider supports only a flat directory. It also supports the notion of referenceable objects being bound into the RMI registry.

At this point, we have looked at how you can use Java to access enterprise data from a variety of services. The next chapter begins to explore how you can create services of your own, beginning with Web server services in the form of a new application structure called a servlet.


Previous Table of Contents Next