A Java EE application's local JNDI context is immutable and is only accessible by that Java EE application. The context is bound at java:comp/env
for each application. It contains references to the resources and Java EE components that the application references.
Because this is an immutable context, we cannot bind anything into it programmatically by using the javax.naming.Context.bind
method. However, we can specify all of the resources and components that we require to be bound in the context, in the Java EE deployment descriptor and the Apache Geronimo-specific deployment plan. The name specified in the ref-name
element is the name under which the resource will be available in the application local JNDI context.
For example, if you specify a ref-name
of jdbc/DataSource
for a DataSource
object as given in the XML fragment shown below:
<resource-ref> <res-ref-name>jdbc/DataSource</res-ref-name> <res-type>javax.sql.DataSource</res...