Basics of JNDI Alessio Bechini June 2002. Naming and Directory Services: Rationale A fundamental element in every application is the capability to find.

Slides:



Advertisements
Similar presentations
Communicating in J2EE.
Advertisements

5 Copyright © 2005, Oracle. All rights reserved. Accessing the Database with Servlets.
11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
Java Network Programming Vishnuvardhan.M. Dept. of Computer Science - SSBN Java Overview Object-oriented Developed with the network in mind Built-in exception.
JNDI Java Naming Directory Interface JNDI is an API specified in Java that provides naming and directory functionality to applications written in Java.
Java Naming and Directory Interface JNDI. v001025JNDI2 Topics Naming and Directory Services JNDI Overview Features and Code Samples JNDI Providers References.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 14: Naming.
EJB Development and Support Services. EJB Development and Support Services Topics to be Covered: EJB Design Bean/Container Interaction Java Naming and.
Directory & Naming Services CS-328 Dick Steflik. A Directory.
Application Server Lecture Paulo Barroso Kris Carver Todd Kitterman Eric Silva.
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
Faculty of Information Technology © Copyright UTS Faculty of Information Technology - JNDIJNDI-1 Advanced Java Programming JNDI v2 Chris Wong
LDAP LIGHT WEIGHT DIRECTORY ACCESS PROTOCOL PRESENTATION BY ALAKESH APURVA DHAN AND ASH.
Microsoft Windows 2003 Server. Client/Server Environment Many client computers connect to a server.
JNDI Java Naming and Directory Interface See also:
EJB. Component Characteristics An enterprise Bean typically contains business logic that operates on the enterprise’s data. An enterprise Bean’s instances.
卓越計劃進度報告 JNDI Java Naming and Directory Interface 網際網路實驗室 報告人 潘燕弘.
Enterprise Java Beans CS-422. Application Servers In the late 1980s and though the mid 1990s a number of corporations (Broadvision, Netscape…) marketed.
Corso di Formazione Sodalia “Enterprise Java Beans” JNDI Java Naming and Directory Interface.
SelfDiagnose “who is to blame” ernest micklei, April 2007.
Developing and Deploying Business Components using PowerJ.
Enterprise JavaBeans EJB Container Services. EJB container Enterprise JavaBeans are deployed in an EJB container within the application server EJB container.
© D. Wong  Indexes  JDBC  JDBC in J2EE (Java 2 Enterprise Edition)
Advanced Java Session 7 New York University School of Continuing and Professional Studies.
Entity Java Beans Jorg Janke Open Source ERP & CRM.
Container-Managed Persistence (CMP) Entity Beans Lesson 3A / Slide 1 of 42J2EE Server Components Objectives In this lesson, you will learn to: Identify.
Replication & EJB Graham Morgan. EJB goals Ease development of applications –Hide low-level details such as transactions. Provide framework defining the.
Enterprise Java Bean Matt. 2 J2EE 3 J2EE Overview.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Introduction to J2EE Architecture Portions by Kunal Mehta.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
TDDD05 EJB Lab (Part of slides reused from Mikhail’s) Lu Li
Message-Driven Beans and EJB Security Lesson 4B / Slide 1 of 37 J2EE Server Components Objectives In this lesson, you will learn about: Identify features.
第十四章 J2EE 入门 Introduction What is J2EE ?
1 LDAP and Java Naming Services Murali. M.Nagendranath.
Topic : JNDI Kaster Nurmukan. JNDI2(c)CDAC(Formerly NCST) What is JNDI? Naming and Directory Services Naming Concepts Issues JNDI Architecture Programming.
Middleware Technology (J2EE/EJB) RMI-IIOP/JNDI. 2 Distributed Objects EJB components are based on distributed objects. A distributed object can be called.
Advanced Programming Rabie A. Ramadan 7.
Java Naming and Directory Interfaces. A naming service is an entity that performs the following tasks:  It associates names with objects. Similar to.
J2EE Overview ver 1.0Page 1 © Wipro Technologies Talent Transformation J2EE Overview.
Comparing JavaBeans and OSGi Towards an Integration of Two Complementary Component Models HUMBERTO CERVANTES JEAN-MARIE FAVRE 09/02.
Source: Peter Eeles, Kelli Houston, and Wojtek Kozaczynsky, Building J2EE Applicationa with the Rational Unified Process, Addison Wesley, 2003 Prepared.
Ch 2 – Application Assembly and Deployment COSC 617 Jeff Schmitt September 14, 2006.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Collaborate Lesson 4C / Slide 1 of 22 Collaborate Knowledge Byte In this section, you will learn about: The EJB timer service Message linking in EJB 2.1.
Java Naming and Directory Interface Matt. 2 What is JNDI.
Session Beans Based on: Patel, Brose, Silverman, Mastering Enterprise JavaBeans 3.0.
Java Network Programming Network Programming Spring 2000 Jeffrey E. Care
Spring LDAP Dima Ionut Daniel.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Enterprise JavaBeans: Fundamentals. EJB Fundamentals(c)CDAC(Formerly NCST)2 Contents Introduction Technology Overview EJB Architecture EJB Specification.
Middleware Technology (J2EE/EJB) EJB Fundamentals.
Java Naming and Directory Interface. Contents Naming and directory services JNDI RMI Conclusion.
JAVA LDAP Dima Ionut Daniel. Contents What is LDAP? LDAP Operations Directory Service JNDI as LDAP API Pooling Spring LDAP UnboundId LDAP SDK JAVA LDAP.
DEVELOPING WEB SERVICES WITH JAVA DESIGN WEB SERVICE ENDPOINT.
EJB. Introduction Enterprise Java Beans is a specification for creating server- side scalable, transactional, multi-user secure enterprise-level applications.
17 Copyright © 2004, Oracle. All rights reserved. Integrating J2EE Components.
SOAP, Web Service, WSDL Week 14 Web site:
©NIIT Session Beans Lesson 1B/ Slide 1 of 37J2EE Server Components Objectives In this lesson, you will learn to: Describe the characteristics of session.
Enterprise Java Beans. Contents  Understanding EJBs  Practice Section.
J2EE Lecture 10: EJB 3.0 Overview
Introduction to J2EE Architecture
Knowledge Byte In this section, you will learn about:
J2EE Application Development
IS 4506 Server Configuration (HTTP Server)
Objectives In this lesson, you will learn to:
Architecture Competency Group
Knowledge Byte In this section, you will learn about:
LDAP LIGHT WEIGHT DIRECTORY ACCESS PROTOCOL
Presentation transcript:

Basics of JNDI Alessio Bechini June 2002

Naming and Directory Services: Rationale A fundamental element in every application is the capability to find and locate components and services. A client looking for a component/service usually knows its name, but not its physical location. The component name correspond to the actual name, typically much more difficult to remember and manage. A well-known naming service is provided on Internet by DNS. For applications, a naming/directory service is the way to get a reference to a required service (e.g. a JDBC data source, a JMS connection factory, an EJB home interface, etc.) DNS

Naming and Directory Services A naming service is an application that contains a set of objects, or references to objects, with corresponding names (usually easy to remember). Such correspondances are called bindings. A directory service allows for the association of attributes to a binding. Some popular directory implementations: Lightweight Directory Access Protocol (LDAP) Network Directory Service (NDS) Network Information Servis Plus (NIS+)

JNDI Overview JNDI (Java Naming Directory Interface) provides Java clients with the capability to access naming and directory services. JNDI is subdivided in the following packages: javax.naming javax.naming.directory javax.naming.event javax.naming.ldap javax.naming.spi JDBC APIs JDBC Driver JNDI APIs SPI Service Provider Interface

JNDI Configuration JNDI configuration could be a quite difficult task. Whenever we use an EJB server, JNDI is started automatically at the same time of the server itself. Such a service is usually already configured for the specific server. Also the client applications using JNDI must be configured, and this task is up to the programmer/assempler/deployer.

JNDI Environment Properties A client (object) uses JNDI to locate remote services; but JNDI might be a remote service as well. Thus, how to locate a naming service without using a naming service? We can do it using environment properties. Some standard JNDI properties: java.naming.factory.initial java.naming.provider.url Java.naning.security.authentication etc.

Context and InitialContext Context (interface) is used to deal with objects that have been bind to a JNDI name. javax.naming.Context contains methods to put objects in the naming service, and to retrieve them. All the naming services have an access point, and in JNDI it is named InitialContext. To obtain an InitialContext, three steps are required: 1.Select the service provider 2.Specify every configuration needed 3.Call the InitialContext constructor, providing the environment properties. !!! A unique InitialContext is not thread-safe!

Use of InitialContext InitialContext must be closed after its usage, as it happens for any resource, e.g. a JDBC connection. The best way to do it is to insert the invocation of the close method inside a finally block. The method getEnvironment of Context returns an Hashtable with all the active properties for the context. The method lookup( name ) returns a reference to the Object corresponding to name. This way, also EJB “home factories” are looked up.

Access to the Environment of an EJB As an EJB usually must not access files, how can an EJB access its configuration properties? A smart way to pass a configuration value to a bean is through its deployment descriptor, adding an env-entry tag, e.g. what a beautiful entry! theNicestGirl java.lang.String ”Anne” An EJB accesses environment properties using an InitialContext object, and looking up the desired property by its name.