Table of Contents

About

JNDI is an interface describing naming and directory functionalities.

It provides applications with methods for performing standard directory operations, such as:

  • associating attributes with objects
  • and searching for objects using their attributes.

Jndi Name Data Source Netbeans

The implementations can be plugged into the JNDI interface using the standard service provider interface (SPI) conventions.

JNDI implementation:

  • LDAP (default),
  • NDS,
  • DNS,
  • and NIS.

Lookup

Three JNDI namespaces are used for portable JNDI lookups:

  • java:global,
  • java:module,
  • and java:app.

global

The java:global JNDI namespace is the portable way of finding remote enterprise beans using JNDI lookups.

JNDI global addresses are of the following form:

java:global[/application name]/module name/enterprise bean name[/interface name]

where:

  • the Default [/application name]/module name is the name of the application and of the module minus the file extension.
  • Application names are required only if the application is packaged within an EAR.
  • The interface name is required only if the enterprise bean implements more than one business interface.

module

The java:module namespace is used to look up local enterprise beans within the same module. JNDI addresses using the java:module namespace are of the following form:

java:module/enterprise bean name/[interface name]

where:

  • The interface name is required only if the enterprise bean implements more than one business interface.

app

The java:app namespace is used to look up local enterprise beans packaged within the same application. That is, the enterprise bean is packaged within an EAR file containing multiple Java EE modules.

JNDI addresses using the java:app namespace are of the following form:

java:app[/module name]/enterprise bean name[/interface name]

where:

  • The module name is optional.
  • The interface name is required only if the enterprise bean implements more than one business interface.

Example

For example, if an enterprise bean, MyBean, is packaged within the web application archive myApp.war, the module name is myApp.

The JNDI name using :

  • java:module namespace is java:module/MyBean
  • the java:global namespace is java:global/myApp/MyBean.

Data Source

With JNDI data source, you can take advantage of connection pooling.

Documentation / Reference