Return-Path: X-Original-To: apmail-directory-api-archive@minotaur.apache.org Delivered-To: apmail-directory-api-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 64F0F11BA3 for ; Tue, 5 Aug 2014 16:39:45 +0000 (UTC) Received: (qmail 82587 invoked by uid 500); 5 Aug 2014 16:39:45 -0000 Delivered-To: apmail-directory-api-archive@directory.apache.org Received: (qmail 82535 invoked by uid 500); 5 Aug 2014 16:39:45 -0000 Mailing-List: contact api-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: api@directory.apache.org Delivered-To: mailing list api@directory.apache.org Delivered-To: moderator for api@directory.apache.org Received: (qmail 27198 invoked by uid 99); 5 Aug 2014 16:15:36 -0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of prabhjot.singh@kaseya.com designates 209.85.214.177 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:mime-version:thread-index:date:message-id :subject:to:cc:content-type; bh=asOdsxA327dVO3nfTmsal3P6bPvMORX62hXGbSDLWxI=; b=aYSLdBnHQn67Gy3iZXyOfd8KF319Wd91kgBlXa81y5eyXngCfRBISGrySyGL+c7kIx Pux696HPHKQNynDsBK1dGx4YtpeDc7+a710fj5mBbufXMG2kiMAay+6JlwzoxMeU0WRH L9HXhvkPrzzC6A/eYFIsiazSiXtZ1e4AEoCzp+vu3rBQNde20TQcd68mxc5ooat9Lz4j KdYVXH7RLQ2V1Be4o4Qdnvy7QIolg/3558tu0RO8iUvh1VxoDKdx491k+f7AQgd13SIa rcrHADkDhwWVKVGIDDzD5rLX7FdwfyfSWhUWoUj3Rb8SQfSY+QnG3lizLhGZUfAhTaMD z65A== X-Gm-Message-State: ALoCoQm/7t+7z9Upp+7fEHxwyAi8XoO7zF9HebgGFWa2EGLs9jzwbmpu1nfgwwqDF3NlPh7k/HEa X-Received: by 10.60.63.233 with SMTP id j9mr6966915oes.23.1407255309744; Tue, 05 Aug 2014 09:15:09 -0700 (PDT) From: Prabhjot Singh MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac+wyGzAJBV+xga9QtGKh9WGGZrtog== Date: Tue, 5 Aug 2014 21:45:08 +0530 Message-ID: <5e7349970f50f9383c0f47474c4c716c@mail.gmail.com> Subject: Apache LDAP API - ActiveDirectory Handling referrals To: api@directory.apache.org Cc: er.prabhjots@gmail.com Content-Type: multipart/alternative; boundary=001a11c1d206d895da04ffe42831 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c1d206d895da04ffe42831 Content-Type: text/plain; charset=UTF-8 Hi Experts, Can you please point me on how to handle referrals in the search operation? I want the logic to follow the referrals so it collects results from all Active Directory DCs. I get below exception even with followReferrals set to true. public List getAllGroups(String customer, String baseDn) throws Exception { LdapConnectionTemplate connection = connections.getLdapConnectionTemplate(customer); SearchRequest searchRequest = connection.newSearchRequest(baseDn, "(objectclass=organizationalUnit)", SearchScope.ONELEVEL, GROUP_ATTRIBUTES); searchRequest = searchRequest.followReferrals(); return connection.search(searchRequest, new GroupMapper()); } java.lang.RuntimeException: ERR_02002_FAILURE_ON_UNDERLYING_CURSOR Failure on underlying Cursor. at org.apache.directory.api.ldap.model.cursor.CursorIterator.next(CursorIterator.java:86) at org.apache.directory.ldap.client.template.LdapConnectionTemplate.search(LdapConnectionTemplate.java:662) at com.kaseya.mobility.directory.core.dao.group.DirectoryDetailsDaoImpl.getAllGroups(DirectoryDetailsDaoImpl.java:53) at com.kaseya.mobility.directory.core.dao.group.DirectoryDetailsDaoImplTest.testGetAllGroups(DirectoryDetailsDaoImplTest.java:66) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: org.apache.directory.api.ldap.model.cursor.CursorLdapReferralException at org.apache.directory.ldap.client.api.EntryCursorImpl.get(EntryCursorImpl.java:164) at org.apache.directory.ldap.client.api.EntryCursorImpl.get(EntryCursorImpl.java:50) at org.apache.directory.api.ldap.model.cursor.CursorIterator.next(CursorIterator.java:80) ... 29 more --001a11c1d206d895da04ffe42831--