JNDI

Java Naming and Naming Interface if part of Java SE:

  1. Standard API to interact with naming and directory services
  2. Provide the ability to look up things in a “registry”
  3. Used in enterprise solutions to locate resources such as EJBs, JMS queues or Web Services

JNDI resources are organized in tree structure:

  1. Analogues to the folder structure of a computer’s file system
  2. SupportsĀ events, lookups, and complex searching against structure

App->JNDI->JNDI IMPL->DS

Finding EJB with JNDI uses four key concepts:

  1. Context
  2. Initial context
  3. Path & Name
  4. Search

Simple JNDI lookup:

[code language=”java”]
String jndiPath = com.development.tutorials.ejb3.RemoteCalculator;

try{

calculator = (RemoteCalculator) c.lookup(jndiPath);

}
[/code]

Problems with JNDI
1. Keep track of JNDI path
2. Bean name

Leave a Reply

Your email address will not be published. Required fields are marked *