directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan Carlos Marin Rincon <jmari...@gmail.com>
Subject LDAP API search cursor returns diferent number of values
Date Fri, 15 Apr 2016 19:59:02 GMT
Hi all,

I´m try to run a search into Tivoli Directory Server, the query is:
(&(objectClass=gruopOfUniqueNames)(uniquemember=<entry_dn>)). If I run that
query in Apache Directory Studio i get 43 entries, but when I try to run
that query in a Java program, never get the 43 entries, sometimes get 40,
sometimes 38, 35, 20, 25, 29... entries, but never the 43 entries. I'm
using api-all-1.0.0-M20, I try with version M33 too, but I got the same
result, sometimes i got entries, sometimes not, but never i got all
results. This issue is urgent because affects PRODUCTION environment.
Thanks for any help.

My Code:

EntryCursor cursor = null;
LdapConnection conn = null;
String query =
"(&(objectClass=groupOfUniqueNames)(uniquemember=<user_dn>))";
try {
    LdapConnectionConfig config = new LdapConnectionConfig();
    config.setLdapHost(<server_ip>);
    config.setLdapPort(<port>);
    config.setName(<user>);
    config.setCredentials(<password>);

    for (int i = 0; i < 10; i++) {
        conn = new LdapNetworkConnection(config);
        conn.bind();

        cursor = conn.search("<base_path>", query, SearchScope.SUBTREE);

        List<Entry> result = new ArrayList<Entry>();

        while (cursor.next()) {
            result.add(cursor.get());
        }

        System.out.println("ENTRIES IT " + i + " : " + result.size());

        try {
            if (cursor != null) {
                cursor.close();
            }

            if (conn != null) {
                conn.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
} catch (LdapException e) {
    e.printStackTrace();
} catch (CursorException e) {
    e.printStackTrace();
}


Results:

ENTRIES IT 0 : 0
ENTRIES IT 1 : 40
ENTRIES IT 2 : 20
ENTRIES IT 3 : 0
ENTRIES IT 4 : 0
ENTRIES IT 5 : 40
ENTRIES IT 6 : 0
ENTRIES IT 7 : 33
ENTRIES IT 8 : 0
ENTRIES IT 9 : 26

Juan Carlos Marín Rincón
Software Architect

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message