带有Active Directory的JNDI PartialResultException

sta*_*ext 15 java jndi ldap active-directory

我基本上走在Active Directory中的LDAP树.

在每个级别,我查询"(objectClass=*)".当我在root上执行此操作时,例如,"dc=example,dc=com"我将获得以下异常.这适用于我们的其他LDAP实例.出于某种原因,仅在我们的Active Directory服务器上出现此异常.在Active Directory服务器上使用JXplorer时,我也会遇到相同的异常.

从网上阅读我发现有人说你应该打开跟随,不知道这意味着什么...所以在我javax.naming.directory.SearchControls通过我调用的查询传递的控件对象()上searchControls.setDerefLinkFlag(true).我也尝试过将其设置false为相同的结果.关于还有什么可能导致这个问题的任何建议?也许我怎么能解决它?

注意:在这篇文章中,我将baseDn更改dc=<my company domain>为我的公司隐私的示例.

javax.naming.PartialResultException: Unprocessed Continuation Reference(s); remaining name 'dc=example,dc=com'
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2820)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2794)
at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1826)
at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1749)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(ComponentDirContext.java:368)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:338)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(PartialCompositeDirContext.java:321)
at javax.naming.directory.InitialDirContext.search(InitialDirContext.java:248)
at com.motio.pi.gui.panels.useraccess.ldap.LDAPConnector.query(LDAPConnector.java:262)
at com.motio.pi.gui.selector.directory.CognosDirectoryBrowserController.expandCognosTreeNode(CognosDirectoryBrowserController.java:99)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.motio.pi.utils.PIThreadDelegate$1.run(PIThreadDelegate.java:54)
at java.lang.Thread.run(Thread.java:662)
Run Code Online (Sandbox Code Playgroud)

sta*_*ext 31

所以,当我使用该方法创建命名上下文时:

javax.naming.ldap.InitialLdapContext.InitialLdapContext(
   Hashtable<?, ?> environment, Control[] connCtls)
Run Code Online (Sandbox Code Playgroud)

在参数中,environment有一个名称属性,Context.REFERRAL其值应设置为:follow.这是我需要的设置.

  • (对于其他人)如果上述解决方案不起作用,您可以尝试以下两件事: **(1)** 当您提到名称时要更具体(例如:`OU=Accounts,DC=x,DC =y` 而不是 `DC=x,DC=y`。**(2)** 将 LDAP 端口号更改为 **3268**(而不是 **389**) (3认同)
  • @startoftext:当然它解决了PartialResultException问题,但它使搜索速度变慢.请参阅http://stackoverflow.com/questions/14136091/ldap-search-is-very-slow.事实上,"跟随"它需要4秒而没有"跟随"它需要1秒钟.如果您有任何解决方案,请提供建议. (2认同)