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<Group> 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