开发者

How can I test LDAP connection using JNDI

开发者 https://www.devze.com 2023-03-29 12:18 出处:网络
I get an exception javax.naming.NameNotFountException: [LDAP: error co开发者_StackOverflow社区de 32 - No Such Object]; remaining name = \'DC=my-company, DC=group\'

I get an exception javax.naming.NameNotFountException: [LDAP: error co开发者_StackOverflow社区de 32 - No Such Object]; remaining name = 'DC=my-company, DC=group'

The cause of it could be, that the DN 'DC=my-company, DC=group' is invalid. But such exception occurs also then if I set ldapAdServer, ldapUsername, ldapPassword to unvalid values. So, I suppose my LDAP connection was not properly set.

How can I test LDAP connection whether it was created successfully?


No Such Object is an error returned by a directory server when the object of the request does not exist. Use the correct base object instead of dc=my-company,dc=com.

If you do not know the base object, you may be able to discover the directory prefix (or naming context) by querying the root DSE. If you do not know the correct base object, you can use the prefix or naming context as the base object until you discover the base object (which should be closer to your data than the prefix or naming context).

More generally speaking, JNDI should not be used if you know for certain that your directory server will be accessed via LDAP. You will be able to quickly develop working, practical code that is more easily understood by others and more efficient if you use a professional quality LDAP SDK such as the one from UnboundID. The standard edition is free of cost and comes with the source code.


But such exception occurs also then if I set ldapAdServer, ldapUsername, ldapPassword to unvalid values.

No it doesn't. You get a different exception.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号