简体   繁体   English

通过glassfish jndi资源获取Active Directory连接

[英]Get Active Directory connection through glassfish jndi resource

I'm trying to get an LDAP-Connection with the attributes provided by a glassfish custom-resource. 我正在尝试使用玻璃鱼定制资源提供的属性来获取LDAP连接。

My jndi settings: 我的jndi设置:

Resourcetype: javax.naming.directory.Directory
Factory-Class: com.sun.jndi.ldap.LdapCtxFactory

Parameters:
java.naming.security.credentials = myPassword
java.naming.security.principal = cn=ldapUser,ou=myOrganization,dc=myDomain,dc=net
URL = ldap://ldapserver/ou=myOrganization,dc=myDomain,dc=net

This is how I get the connection in Java: 这就是我在Java中获得连接的方式:

Context initCtx = new InitialContext();
DirContext ctx = (DirContext) initCtx.lookup("CMDB2LDAP");

This works perfectly with OpenLDAP but when I try to connect to an AD 2003 I get the following Exception: 这与OpenLDAP完美配合,但是当我尝试连接到AD 2003时,出现以下异常:

javax.naming.NamingException: [LDAP: error code 1 - 00000000: LdapErr: DSID-0C090627, comment: In order to perform this operation a successful bind must be completed on the connection., data 0, vece]; remaining name ''

When I create my own DirContext and put exactly the same properties in it, the connection works flawlessly. 当我创建自己的DirContext并在其中放置完全相同的属性时,连接可以正常工作。

I would prefer to get the connection settings from glassfish for the sake of easy administration. 为了便于管理,我希望从glassfish获取连接设置。

尝试添加java.naming.referral = follow作为另一个属性,看看是否java.naming.referral = follow

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM