Skip Headers
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g (10.1.3.5.0)

Part Number E13981-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

Setting JNDI Properties in an Enterprise Bean

If the client is collocated with the target, the client exists within the same application as the target, or the target exists within its parent, then you do not need to initialize JNDI properties. Otherwise, you must initialize JNDI properties in one of the following ways:

This section describes the following:

For more information, see the following:

Setting JNDI Properties With the JNDI Properties File

You can set JNDI properties in a file named jndi.properties that conforms to the requirements specified in the java.util.Properties method load.

Set JNDI properties as follows:

<PropertyName>=<PropertyValue>

For example:

java.naming.factory.initial= oracle.j2ee.server.ApplicationClientInitialContextFactory

For property names, see the field definitions in javax.naming.Context.

For an example, see "Specifying Credentials in JNDI Properties".

If setting the JNDI properties within the jndi.properties file, make sure that this file is accessible from the client CLASSPATH, or specified in ejb-ref-mapping attribute jndi-properties-file in the appropriate the OC4J-proprietary deployment XML file (see "Configuring an Environment Reference to a Remote EJB: Unclustered Separate Web Tier and EJB Tier").

Setting JNDI Properties With System Properties

You can set JNDI properties as system properties specified either on the command line as a -D argument or as an environment reference (see "Configuring an Environment Reference to an Environment Variable").

Setting JNDI Properties in the Initial Context

You can set JNDI properties by creating a HashTable and populating it with the required properties using javax.naming.Context fields as keys and String objects as values. When you instantiate the initial context, pass the HashTable into the the initial context constructor.

For an example, see "Specifying Credentials in the Initial Context".