Using WebLogic’s JNDI
Each WebLogic server maintains a local JNDI tree. Typically, you will bind various J2EE resources to the JNDI tree, such as JDBC data sources, EJB home objects, JMS connection factories, and more. You can use the Administration Console to view the contents and structure of the JNDI tree on a server. Select a server from the left frame of the Administration Console, right-click the server node, and choose the “View JNDI tree” option from the pop-up menu. This launches a new window that displays the contents of the JNDI tree for the selected server. You can now navigate the JNDI tree and view the various objects bound to it.
In the following sections, you will learn how to programmatically establish a connection to WebLogic’s JNDI server, from both an external client and an internal J2EE component, and how to use the connection to locate and bind objects. As the JNDI tree also permits authorization policies, we also will look at a few security issues surrounding the use of a JNDI tree.
Creating a Context
In
order to access WebLogic’s JNDI tree, you need to
establish a standard JNDI InitialContext
representing the context root of the server’s
directory service. You can do this by passing a
Hashtable of property/value pairs to the
javax.naming.InitialContext( ) constructor. The
Hashtable represents environment properties that are used to establish the context; in an external client, you typically will need to supply at least a URL property that points to a server ...