Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. javax.naming.SizeLimitExceededException: [LDAP: error code 4 - Sizelimit Exceeded]; remaining name '/'
  2. at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3119)
  3. at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3013)
  4. at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2820)
  5.  
  6. public class UserContextMapper implements ContextMapper {
  7.  
  8. private static ApplicationContext appContext = new ClassPathXmlApplicationContext(new String[]{"spring-config.xml"});
  9.  
  10. public Object mapFromContext(Object ctx) {
  11. Class<User> clazz = User.class;
  12. LdapTemplate ldapTemplate = (LdapTemplate) appContext.getBean("ldapTemplate");
  13.  
  14. User user = ldapTemplate.getObjectDirectoryMapper().mapFromLdapDataEntry((DirContextOperations) ctx, clazz);
  15. return user;
  16. }
  17. }
  18.  
  19. public List<User> getLdapQueryResult(final LdapName dn, final Filter filter) throws NamingException {
  20. final PagedResultsDirContextProcessor processor = new PagedResultsDirContextProcessor(getPageSize());
  21. final SearchControls searchControls = new SearchControls();
  22. final UserContextMapper ucm = new UserContextMapper();
  23. searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE);
  24. return SingleContextSource.doWithSingleContext(
  25. ldapTemplate.getContextSource(), new LdapOperationsCallback<List<User>>() {
  26. @Override
  27. public List<User> doWithLdapOperations(LdapOperations operations) {
  28. List<User> result = new LinkedList<User>();
  29. do {
  30. List<User> oneResult = operations.search(dn, filter.encode(), searchControls, ucm, processor);
  31. result.addAll(oneResult);
  32. } while (processor.hasMore());
  33. return result;
  34. }
  35. });
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement