Sun Java System Application Server Enterprise Edition 8.2 管理指南

使用外部 JNDI 系统信息库和资源

通常,在 Application Server 上运行的应用程序需要访问存储在外部 JNDI 系统信息库中的资源。例如,一般的 Java 对象可能会以 Java 模式存储在 LDAP 服务器中。外部 JNDI 资源元素允许用户配置此类外部资源系统信息库。外部 JNDI 工厂必须实现 javax.naming.spi.InitialContextFactory 接口。

使用外部 JNDI 资源的示例:

<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>