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:

String jndiPath = com.development.tutorials.ejb3.RemoteCalculator;

try{

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

}

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s