Client Code, test client with main method:
if (args[0].equalsIgnoreCase("SEARCH")) {
testTenantCrudsMain.testSearchEntry("uid=exampleuser,ou=users,ou=example,o=vsc");
}
void testSearchEntry(String searchDn) throws LdapException {
LdapConnection connection = getConnection(connector);
try {
EntryCursor entryCursor = connection.search(searchDn,
"(objectclass=*)", SearchScope.SUBTREE, "*");
while (entryCursor.next()){
System.out.println("entry is "+ entryCursor.get());
}
Server code Snippet:
EntryCursor cursor = connector.searchThirdPartyLdap(distinguishedName);
Entry entry = cursor.get();
Log.info(entry); // valid entry
Return new EntryFilteringCursorImpl(
new SingletonCursor<Entry>( entry), searchContext,
service.getSchemaManager() );
I believe the above should work, correct?
Stacktrace/console output
17:57:49.805 [NioProcessor-2] DEBUG
org.apache.directory.ldap.client.api.LdapNetworkConnection - ------->
MessageType : SEARCH_RESULT_DONE
Message ID : 3
Search Result Done
Ldap Result
Result code : (OTHER) other
Matched Dn : ''
Diagnostic message : 'OTHER: failed for MessageType : SEARCH_REQUEST
Message ID : 3
SearchRequest
baseDn : ' uid=exampleuser,ou=users,ou=example,o=vsc '
filter : '(objectClass=*)'
scope : whole subtree
typesOnly : false
Size Limit : no limit
Time Limit : no limit
Deref Aliases : deref Always
attributes : '*'
org.apache.directory.api.ldap.model.message.SearchRequestImpl@75502e41: null'
Message received <-------
17:57:49.805 [NioProcessor-2] DEBUG
org.apache.directory.ldap.client.api.LdapNetworkConnection - Getting <3,
org.apache.directory.ldap.client.api.future.SearchFuture>
17:57:49.805 [NioProcessor-2] DEBUG
org.apache.directory.ldap.client.api.LdapNetworkConnection - Search failed :
MessageType : SEARCH_RESULT_DONE
Message ID : 3
Search Result Done
Ldap Result
Result code : (OTHER) other
Matched Dn : ''
Diagnostic message : 'OTHER: failed for MessageType : SEARCH_REQUEST
Message ID : 3
SearchRequest
baseDn : ' uid=exampleuser,ou=users,ou=example,o=vsc"
filter : '(objectClass=*)'
scope : whole subtree
typesOnly : false
Size Limit : no limit
Time Limit : no limit
Deref Aliases : deref Always
attributes : '*'
org.apache.directory.api.ldap.model.message.SearchRequestImpl@75502e41: null'
17:57:49.805 [NioProcessor-2] DEBUG
org.apache.directory.ldap.client.api.LdapNetworkConnection - Removing <3,
org.apache.directory.ldap.client.api.future.SearchFuture>
17:57:49.806 [NioProcessor-2] DEBUG
org.apache.directory.ldap.client.api.LdapNetworkConnection - received a NoD,
closing everything
-----Original Message-----
From: Emmanuel Lécharny [mailto:[email protected]]
Sent: Friday, September 01, 2017 5:36 PM
To: [email protected]
Subject: Re: EntryFilteringCursor question
Le 01/09/2017 à 22:37, Sathyanarayan, Harish a écrit :
> Server code I have:
>
> EntryFilteringCursor entryFilteringCursor = new EntryFilteringCursorImpl(
> new SingletonCursor<Entry>( returnedEntry ),
> null, null );
>
> return entryFilteringCursor;
>
> Client Code:
>
> EntryCursor ec = connection.search(searchDn, "(objectclass=*)",
> SearchScope.SUBTREE);
>
> So where do I need to fix?
First, you should always pass the SearchOperationContext to your
EntryFilteringCursorImplinstance. If you pass null, you'll get soem NPE all
over your call.
That being said, I don't see the connection between your server implem and your
client impl. I don't know where your client codeegt called.
Also provide a stack trace of the error you get.
--
Emmanuel Lecharny
Symas.com
directory.apache.org
The information contained in this electronic mail transmission may be
privileged and confidential, and therefore, protected from disclosure. If you
have received this communication in error, please notify us immediately by
replying to this message and deleting the email and its attachments from all
computers without copying or disclosing it.