【问题标题】:JNDI with Active Directory PartialResultExceptionJNDI 与 Active Directory PartialResultException
【发布时间】:2011-07-27 04:41:38
【问题描述】:

我基本上是在 Active Directory 中遍历 LDAP 树。

在每个级别我都查询"(objectClass=*)"。当我在根目录上执行此操作时,例如"dc=example,dc=com" 我得到以下异常。这在我们的其他 LDAP 实例上运行良好。出于某种原因,仅在我们的 Active Directory 服务器上我得到了这个异常。在我们的 Active Directory 服务器上使用 JXplorer 时,我也遇到了同样的异常。

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

注意:在这篇文章中,我将 baseDn 从 dc=<my company domain> 更改为 example,以保护我的公司隐私。

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)

【问题讨论】:

    标签: java active-directory ldap jndi


    【解决方案1】:

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

    javax.naming.ldap.InitialLdapContext.InitialLdapContext(
       Hashtable<?, ?> environment, Control[] connCtls)
    

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

    【讨论】:

    • @startoftext:当然它解决了 PartialResultException 问题,但它会使搜索变慢。请参考stackoverflow.com/questions/14136091/ldap-search-is-very-slow。事实上,对我来说,使用“follow”需要 4 秒,而没有“follow”需要 1 秒。如果您有任何解决方案,请提出建议。
    • @Karthik Bose 我不再使用 ldap 了,很抱歉我帮不上忙。
    • (对于其他人)如果上面的解决方案不起作用,您可以尝试以下 2 件事:(1) 提及名称时更具体(例如:OU=Accounts,DC=x,DC=y 而不是 DC=x,DC=y(2) 将 LDAP 端口号更改为 3268(而不是 389
    【解决方案2】:

    如果您在后续使用引荐使用时遇到异常(例如:连接超时),您可以使用引荐忽略,但您不想获得部分异常,您可以使用 3268 端口号而不是 389 此端口正在使用全局编录LDAP。您可以从以下链接中找到信息;

    https://technet.microsoft.com/en-us/library/how-global-catalog-servers-work(v=ws.10).aspx

    【讨论】:

      猜你喜欢
      • 2014-10-05
      • 1970-01-01
      • 2011-05-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多