I am using the person demo sample project from the spring ldap 1.3.0.RELEASE. While trying to test the method to search for all persons
sorted by last name, I am getting an OperationNotSupportedException. Any help is appreciated.
The method to retrieve all persons sorted by last name is as follows:
The PersonContextMapper instance is the same as the one provided in the sample. Including that as well:Code:public List findAllSortedByLastName() { SortControlDirContextProcessor sortControl = new SortControlDirContextProcessor("sn"); AggregateDirContextProcessor processor = new AggregateDirContextProcessor(); processor.addDirContextProcessor(sortControl); SearchControls searchControls = new SearchControls(); searchControls.setReturningObjFlag(true); searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE); return ldapTemplate.search("", "(objectclass=person)", searchControls , new PersonContextMapper(), processor); }
The trace follows:Code:private static class PersonContextMapper extends AbstractContextMapper { public Object doMapFromContext(DirContextOperations ctx) { DirContextAdapter context = (DirContextAdapter) ctx; Person person = new Person(); person.setFullName(context.getStringAttribute("cn")); person.setLastName(context.getStringAttribute("sn")); person.setDescription(context.getStringAttribute("description")); person.setPhone(context.getStringAttribute("telephoneNumber")); DistinguishedName dn = (DistinguishedName) context.getDn(); person.setCountry(dn.getValue("c")); person.setCompany(dn.getValue("ou")); return person; } }
Code:org.springframework.ldap.OperationNotSupportedException: [LDAP: error code 12 - Unsupport critical control: 1.2.840.113556.1.4.473]; nested exception is javax.naming.OperationNotSupportedException: [LDAP: error code 12 - Unsupport critical control: 1.2.840.113556.1.4.473]; remaining name '' at org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:199) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:319) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:259) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:606) at org.springframework.ldap.demo.solution.PersonDaoImpl.findAllSortedByLastName(PersonDaoImpl.java:55) at org.springframework.ldap.demo.dao.PersonDaoIntegrationTest.testFindAllSortedByLastName(PersonDaoIntegrationTest.java:157) 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:592) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) Caused by: javax.naming.OperationNotSupportedException: [LDAP: error code 12 - Unsupport critical control: 1.2.840.113556.1.4.473]; remaining name '' at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3131) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3017) at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2823) at com.sun.jndi.ldap.LdapCtx.searchAux(LdapCtx.java:1832) at com.sun.jndi.ldap.LdapCtx.c_search(LdapCtx.java:1755) 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 org.springframework.ldap.core.LdapTemplate$4.executeSearch(LdapTemplate.java:253) at org.springframework.ldap.core.LdapTemplate.search(LdapTemplate.java:293) ... 24 more


Reply With Quote
