O'Reilly logo

Java Servlet & JSP Cookbook by Bruce W. Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

25.4. Configuring a JNDI Resource in WebLogic

Problem

You want to bind an object to BEA WebLogic's JNDI implementation.

Solution

Use the WebLogic Administration console.

Discussion

Here are the steps needed to bind a javax.mail.Session object (which I use as an example for this recipe) to WebLogic's JNDI implementation. The advantage of this approach is that the available Session is already configured with elements such as its SMTP host (see Table 25-1). The Session is "ready to go" for the code that will eventually look up and use the object.

  1. Log in to the WebLogic Administration console, which involves using a browser URL such as http://localhost:7001/console.

  2. Go to Your-domain-name Services Mail in the lefthand column menu.

  3. Click on "Configure a new Mail Session . . . " This produces the window shown in Figure 25-4.

Configuring a javax.mail.Session type as a JNDI object using the WebLogic Administration console

Figure 25-4. Configuring a javax.mail.Session type as a JNDI object using the WebLogic Administration console

  1. Fill in the text fields in the resulting window. Give the Session object a JNDI name (under "JndiName"), which is the name that the code uses to look up the object.

  2. Enter any properties for the Session by typing in the property name, an equals sign (=), and the property value. See Table 25-1.

  3. Click the "Apply" button, then choose the "Targets" tab. The resulting screen allows you to associate the JNDI object with one or more servers.

Now the JNDI object is available ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required