Java Naming and Naming Interface if part of Java SE:
- Standard API to interact with naming and directory services
- Provide the ability to look up things in a “registry”
- Used in enterprise solutions to locate resources such as EJBs, JMS queues or Web Services
JNDI resources are organized in tree structure:
- Analogues to the folder structure of a computer’s file system
- SupportsĀ events, lookups, and complex searching against structure
App->JNDI->JNDI IMPL->DS
Finding EJB with JNDI uses four key concepts:
- Context
- Initial context
- Path & Name
- 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