Sun Java System Application Server Platform Edition 8.1 2005Q2 Update 2 Administration Guide

- Previous: About Custom Resources
- Next: To create an external resource

## Using External JNDI Repositories and Resources

Often applications running on the Application Server require access to resources stored in an external JNDI repository. For example, generic Java objects could be stored in an LDAP server as per the Java schema. External JNDI resource elements let users configure such external resource repositories. The external JNDI factory must implement `javax.naming.spi.InitialContextFactory` interface.

An example of the use of an external JNDI resource is:

    <resources>
     <!-- external-jndi-resource element specifies how to access J2EE resources
     -- stored in an external JNDI repository. The following example
     -- illustrates how to access a java object stored in LDAP.
     -- factory-class element specifies the JNDI InitialContext factory that
     -- needs to be used to access the resource factory. property element
     -- corresponds to the environment applicable to the external JNDI context
     -- and jndi-lookup-name refers to the JNDI name to lookup to fetch the
     -- designated (in this case the java) object.
     -->
      <external-jndi-resource jndi-name="test/myBean"
          jndi-lookup-name="cn=myBean"
          res-type="test.myBean"
          factory-class="com.sun.jndi.ldap.LdapCtxFactory">
        <property name="PROVIDER-URL" value="ldap://ldapserver:389/o=myObjects" />
        <property name="SECURITY_AUTHENTICATION" value="simple" />
        <property name="SECURITY_PRINCIPAL", value="cn=joeSmith, o=Engineering" />
        <property name="SECURITY_CREDENTIALS" value="changeit" />
      </external-jndi-resource>
    </resources>

- Previous: About Custom Resources
- Next: To create an external resource

- © 2010, Oracle Corporation and/or its affiliates