0% found this document useful (0 votes)
17 views21 pages

05 JNDI Slides

This document provides an overview of the Java Naming and Directory Interface (JNDI). It describes JNDI's architecture and how it provides a uniform way to access different naming and directory services. It also discusses how to view the JNDI tree in WebLogic Server and deploy startup and shutdown classes using the Administration Console.

Uploaded by

shamsher3052
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views21 pages

05 JNDI Slides

This document provides an overview of the Java Naming and Directory Interface (JNDI). It describes JNDI's architecture and how it provides a uniform way to access different naming and directory services. It also discusses how to view the JNDI tree in WebLogic Server and deploy startup and shutdown classes using the Administration Console.

Uploaded by

shamsher3052
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Module 5

Understanding JNDI

At the end of this module you will be able to:


9 Describe naming and directory services
9 Detail the high-level architecture of JNDI
9 Define basic terminology
9 View the JNDI tree in WebLogic Server
9 Use the Administration Console to deploy a
startup or shutdown class

Understanding JNDI-1 © 2006 BEA Systems, Inc. 237


Road Map

1. Introduction to JNDI
– What Are Directory and Naming Services and How Do
They Work
– The High-level Architecture of JNDI
– Viewing JNDI Tree Via the Administration Console and
the Command-Line
2. Startup and Shutdown Classes

Understanding JNDI-2 © 2006 BEA Systems, Inc. 238


What Is JNDI?

f The Java Naming and Directory Interface is an API for


accessing different naming and directory services
uniformly.
f This is a major step forward because:
– Different services use vastly different naming schemes
– Java applications will be able to navigate seamlessly across
databases, files, directories, objects and networks

Understanding JNDI-3 © 2006 BEA Systems, Inc. 239


Why JNDI ?

f In WebLogic Server, JNDI serves as a repository and


lookup service for J2EE objects including:
– EJB home stubs
– JDBC DataSources
– JMS connection factories, queues and topics
– RMI stubs

Understanding JNDI-4 © 2006 BEA Systems, Inc. 240


JNDI Structure

Written by
Application Code Developer
JNDI API
Naming Manager JNDI API
JNDI SPI
WLS LDAP File Sys DNS
Other Purchased
Driver Driver Driver Driver

WLS LDAP File DNS


Other Service
Server Server System System

Understanding JNDI-5 © 2006 BEA Systems, Inc. 241


Naming Service

f A naming service provides a ID1

Objects
method for mapping identifiers to
entities or objects: ID2

ID3

ID4
f Naming Service vocabulary:

Term Definition Example


www.bea.com is
Association of an atomic name
Binding bound to
and an object 209.10.217.38
A set of unique names in a www.bea.com/
Namespace
naming system products

Understanding JNDI-6 © 2006 BEA Systems, Inc. 242


A JNDI Tree
Root R
Context

A binding associates an IC Initial Context


object with a logical
name and a context

Context “B”
is bound to
A B Initial Context
O1
Object “O1”
is bound to
Initial C
O2 O3 O3 O4
Context
Object “O2” Object “O3”
is bound to is bound to both
Context “A” Context “A” and “B”
Understanding JNDI-7 © 2006 BEA Systems, Inc. 243
Contexts and Subcontexts

f Subcontexts are referenced through dot delimiters (.)


f Subcontexts must be created before objects are placed
into them

If the following context exists:


com.bea.examples

you cannot bind:


com.bea.examples.ejb.SomeObject

without first creating:


com.bea.examples.ejb
10
0101
1110

Understanding JNDI-8 © 2006 BEA Systems, Inc. 244


JNDI for Administrators

f An administrator needs to understand JNDI because it


will be their job to:
– verify objects are bound in the JNDI tree
– set security on contexts within the JNDI tree

Understanding JNDI-9 © 2006 BEA Systems, Inc. 245


Viewing the JNDI Tree

4 5

Understanding JNDI-10 © 2006 BEA Systems, Inc. 246


Listing JNDI Contents

f WLST provides a command line utility for viewing


JNDI bindings.
f jndi() changes to the jndi tree and ls() lists the
bindings

10
0101
1110

Understanding JNDI-11 © 2006 BEA Systems, Inc. 247


Section Review

In this section we discussed:


9 What directory and naming services are and how they
work
9 The high-level architecture of JNDI
9 Viewing the JNDI tree via
the Administration Console
and the command line

Understanding JNDI-12 © 2006 BEA Systems, Inc. 248


Road Map

1. Introduction to JNDI
2. Startup and Shutdown Classes
– What Are Startup and Shutdown Classes and How Do
They Work
– Deploying a Startup or Shutdown Class Using the
Administration Console

Understanding JNDI-13 © 2006 BEA Systems, Inc. 249


What Is a Startup Class?

f A startup class is a class that is loaded and executed


when WebLogic Server boots.
f You can use a startup class to:
– initialize objects in memory
– reconstruct a JNDI tree
– load critical values from the database
– recover the system to the state that existed before shutdown

Understanding JNDI-14 © 2006 BEA Systems, Inc. 250


What Is a Shutdown Class?

f A shutdown class is a class which gets executed when


WebLogic Server is shutting down.
f Shutdown classes are usually used to free resources
obtained by startup classes.

Understanding JNDI-15 © 2006 BEA Systems, Inc. 251


Defining Startup/Shutdown Classes…

3
4

Understanding JNDI-16 © 2006 BEA Systems, Inc. 252


…Deploying Startup/Shutdown Classes

Understanding JNDI-17 © 2006 BEA Systems, Inc. 253


When Are Startup Classes Loaded?

f By default, startup classes are loaded after the J2EE


deployment units.
f J2EE deployment units load in this order: JDBC, JMS,
Connectors, EJBs, Web Applications.
f If “Run Before Application Deployments” is checked,
then startup class are loaded right before deploying
JDBC Data Sources.

Understanding JNDI-18 © 2006 BEA Systems, Inc. 254


Section Review

In this section we discussed:


9 What startup and shutdown classes are and how they
work
9 How to deploy a startup or shutdown class using the
Administration Console

Understanding JNDI-19 © 2006 BEA Systems, Inc. 255


Exercise

Working With Startup Classes and JNDI


f In this lab you are going to deploy a startup class that
binds objects into the JNDI tree.
f Ask the instructor for any clarification.
f The instructor will
determine the stop time.

Lab Exercise

Understanding JNDI-20 © 2006 BEA Systems, Inc. 256


Module Review

In this module we discussed:


– What naming and directory services are
– The high-level architecture of JNDI
– Terminology used in naming and directory services
– How to view the JNDI tree in WebLogic Server
– How to deploy a startup
or shutdown class
via Administration Console

Understanding JNDI-21 © 2006 BEA Systems, Inc. 257

You might also like