7.8. JNDI configuration

All the code examples presented so far have assumed that the JNDI lookup was being done using the default configuration. This is appropriate when EJBs are looking up each other, or looking up resources, but won’t allow a standalone client to get access to an EJB server. To see how this can be done, we need to know first the general technique for configuring the JNDI system on the client.

The set of configuration information that JNDI requires is called its environment. InitialContext looks for its environment in three places, in this order:

  • in a Hashtable passed to its constructor;

  • in any file on the CLASSPATH called jndi.properties; and

  • (in some cases) in the system properties.

Wherever the environment is supplied, the ...

Get Applied Enterprise JavaBeans™ Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.