2011-03-31 36 views
14

我基本上走在Active Directory中的LDAP樹上。帶有Active Directory的JNDI PartialResultException

在每一級我查詢"(objectClass=*)"。當我在根上執行此操作時,例如"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) 

回答

31

所以,當我創建我的方法命名上下文:

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

在激烈的爭論environment有名爲Context.REFERRAL的屬性,並將其值應設置爲:follow。這是我需要的設置。

+2

@startoftext:中 - 當然,它解決了PartialResultException問題,但它使得搜索速度較慢。請參閱http://stackoverflow.com/questions/14136091/ldap-search-is-very-slow。事實上,'追蹤'需要4秒,沒有'追蹤'需要1秒。請諮詢,如果你有任何解決方案。 – 2013-05-07 05:31:02

+0

@Karthik Bose我不再與ldap一起工作,所以對不起,我無法幫忙。 – startoftext 2013-05-07 17:11:25

+0

(對於其他人)如果上述解決方案不起作用,您可以嘗試以下兩件事:**(1)**當您提及該名稱時更具體(例如:'OU = Accounts,DC = x, DC = y'而不是DC = x,DC = y' **(2)**將LDAP端口號更改爲** 3268 **(而不是** 389 **) – 2015-11-24 09:04:18