带有Active Directory的JNDI PartialResultException

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

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

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

注意:在这篇文章中,我将baseDn从dc=更改为我公司隐私的示例。

 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) 

所以当我用这个方法创建我的命名上下文时:

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

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

如果你在下面的引用用法时遇到exception(例如:连接超时)你可以使用引用忽略但你不想得到部分exception你可以使用3268端口号而不是389这个端口正在使用ldap的全局目录。 您可以从以下链接中找到信息;

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