Announcement Announcement Module
Collapse
No announcement yet.
StackOverflowError - SingleContextSource$NonClosingDirContextInvocationHandler.invoke Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • StackOverflowError - SingleContextSource$NonClosingDirContextInvocationHandler.invoke

    I am using spring-ldap-core version 1.3.0.RELEASE

    I get the following...
    Code:
    java.lang.StackOverflowError
    at org.springframework.ldap.core.support.SingleContex tSource$NonClosingDirContextInvocationHandler.invo ke(SingleContextSource.java:120)
    at $Proxy752.hashCode(Unknown Source)
    at org.springframework.ldap.core.support.SingleContex tSource$NonClosingDirContextInvocationHandler.invo ke(SingleContextSource.java:128)
    at $Proxy752.hashCode(Unknown Source)
    at org.springframework.ldap.core.support.SingleContex tSource$NonClosingDirContextInvocationHandler.invo ke(SingleContextSource.java:128)
    at $Proxy752.hashCode(Unknown Source)
    at org.springframework.ldap.core.support.SingleContex tSource$NonClosingDirContextInvocationHandler.invo ke(SingleContextSource.java:128)
    at $Proxy752.hashCode(Unknown Source)
    at org.springframework.ldap.core.support.SingleContex tSource$NonClosingDirContextInvocationHandler.invo ke(SingleContextSource.java:128)
    at $Proxy752.hashCode(Unknown Source)
    at org.springframework.ldap.core.support.SingleContex tSource$NonClosingDirContextInvocationHandler.invo ke(SingleContextSource.java:128)
    at $Proxy752.hashCode(Unknown Source)

    Code is as follows...
    Code:
    public class LdapUserServiceImpl implements LdapUserService {
    
        private static final Logger LOG = Logger.getLogger(LdapUserServiceImpl.class);
    
        private final boolean ldapPagingEnabled;
        private final LdapTemplate ldapTemplate;
        private final LdapContextSource ldapContextSource;
        private final LDAPAttributesMapper ldapMapper;
        private final int ldapSizeLimit;
        private final String searchBase;
        private final String searchFilterUsers;
    
        public LdapUserServiceImpl(final boolean ldapPagingEnabled, final LdapTemplate ldapTemplate,
                final LdapContextSource ldapContextSource, final LDAPAttributesMapper ldapMapper,
                final int ldapSizeLimit, final String searchBase, final String searchFilterUsers) {
            this.ldapPagingEnabled = ldapPagingEnabled;
            this.ldapTemplate = ldapTemplate;
            this.ldapContextSource = ldapContextSource;
            this.ldapMapper = ldapMapper;
            this.ldapSizeLimit = ldapSizeLimit;
            this.searchBase = searchBase == null || searchBase.equalsIgnoreCase("ROOT") ? ""
                    : searchBase;
            this.searchFilterUsers = searchFilterUsers;
        }
    
        @SuppressWarnings("unchecked")
        public List<LDAPUser> getUsersToSyncFromLDAP() {
            // reset the single connection in order to avoid dealing with
            // 'connection reset' issues
            ldapTemplate.setContextSource(new SingleContextSource(ldapContextSource
                    .getReadOnlyContext()));
            // now do the search
            PagedResultsDirContextProcessor pagingProcessor = new PagedResultsDirContextProcessor(
                    ldapSizeLimit);
            final SearchControls controls = new SearchControls();
            controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
            final AttributesMapperCallbackHandler handler = new AttributesMapperCallbackHandler(
                    ldapMapper);
            byte[] cookie;
            if (ldapPagingEnabled) {
                do {
                    ldapTemplate.search(searchBase, searchFilterUsers, controls, handler,
                            pagingProcessor);
                    pagingProcessor = new PagedResultsDirContextProcessor(ldapSizeLimit,
                            pagingProcessor.getCookie());
                    cookie = pagingProcessor.getCookie().getCookie();
                } while (cookie != null && cookie.length != 0);
            } else {
                ldapTemplate.search(searchBase, searchFilterUsers, controls, handler);
            }
            final List<LDAPUser> result = handler.getList();
            LOG.info(result.size() + " users found in LDAP");
            return result;
        }
    }
    Last edited by neville.sequeira; Apr 2nd, 2014, 08:36 PM.
Working...
X