Java Naming and Directory Interface
Core infrastructure (glue) for locating objects or services within an application server
Also allows external clients to locate services
Important for clustering: hides actual location
Divided into API and SPI
Applications code against the API
Application servers provide the SPI
SPIs for accessing remote resources, such as LDAP, DNS, NIS, file systems, RMI registry
JNDI in Java EE JNDI is to Java EE what DNS is to Internet apps JNDI maps high-level names to resources like mail sessions, database connection pools, EJBs, and plain environmental properties JNDI organizes its namespace using Environmental Naming Context (ENC) naming convention:
Starts with java:comp/env
Private to each application
Contexts are delimited with a forward-slash (/)
JNDI ENC naming convention:
java:comp/env/var - Environmental variables
java:comp/env/url - URLs
java:comp/env/mail - JavaMail sessions
java:comp/env/jms - JMS connection factories and destinations
java:comp/env/ejb - EJB home interfaces
java:comp/env/jdbc - JDBC DataSources
These core tutorials will help you to learn the fundamentals of JBOSS. For an in-depth understanding and practical experience, explore Online JBOSS Training.
JNDI on JBoss Supports both local (optimized) and remote (over RMI) access to named objects Provides a JVM-private app-shared java: context in addition to app-private java:comp Everything outside java: is public and externally visible Exposes JNDI operations over JMX invoke operations - allows access over HTTP/S Supports viewing JNDI Tree remotely Supports clustering through HA-JNDI Configured in ${jboss.server.config.url}/jboss-service.xml:
<mbean code="org.jboss.naming.NamingService"
name="jboss:service=Naming"
xmbean-dd="resource:xmdesc/NamingService-xmbean.xml">
<mbean code="org.jboss.naming.JNDIView"
name="jboss:service=JNDIView"
xmbean-dd="resource:xmdesc/JNDIView-xmbean.xml">
</mbean>
Client configuration ${jboss.server.config.url}/jndi.properties:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
Remote clients would need to add:
java.naming.provider.url=jnp://jbosshost.domain.com:1099
You liked the article?
Like : 0
Vote for difficulty
Current difficulty (Avg): Medium
1/4
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.
Stay Updated
Get stories of change makers and innovators from the startup ecosystem in your inbox