[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: (ITS#3430) Problems using pagedResultsControl
The server should be returning unwillingToPerform here,
see ITS#3308.
At 04:33 AM 12/9/2004, Fred.Voelz@gft.com wrote:
>Full_Name: Fred Völz
>Version: 2.2.17
>OS: SUSE-Linux
>URL:
>Submission from: (NULL) (193.158.104.65)
>
>
>I'm using openladap version 2.2.17 under SUSE-Linux. The Java-application runs
>with jdk 1.4.2_6 on WinXP SP2.
>I'm using the LDAP Booster Pack 1.0.
>Here is a short sequence of my programm...
>
>Hashtable env = new Hashtable();
>env.put(Context.SECURITY_AUTHENTICATION, "simple");
>env.put(Context.SECURITY_PRINCIPAL, "cn=manager, dc=thyssenkrupp, dc=com");
>env.put(Context.SECURITY_CREDENTIALS, "anfang");
>env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
>env.put(Context.PROVIDER_URL, "ldap://servername:389");
>env.put("java.naming.ldap.version", "3");
>env.put("com.sun.jndi.ldap.connect.pool", "true");
>
>try
>{
> // create context
> LdapContext ctx = new InitialLdapContext(env, null);
>
> // looking what is all supported
> Attributes attrs = ctx.getAttributes( URL,
> new String[]{"supportedcontrol"});
> System.out.println(attrs); // Close the context when we're done
>
> Control[] ctxCtls = new Control[]{ new PagedResultsControl( 5 ) };
> ctx.setRequestControls( ctxCtls);
>
> //Perform the search by using the original context
> NamingEnumeration answer = ctx.search("ou=user,dc=mydomain,dc=com",
> "(sn=*)", null);
>
> //Enumerate the answer
> while (answer.hasMore())
> {
> SearchResult sr = (SearchResult)answer.next();
> ...
> }
>
>}
>catch(Exception exc)
>{
> exc.printStackTrace();
>}
>
>If I run this code I get following output:
>
>{supportedcontrol=supportedControl:
> 2.16.840.1.113730.3.4.18,
> 2.16.840.1.113730.3.4.2,
> 1.3.6.1.4.1.4203.1.10.1,
> 1.2.840.113556.1.4.1413,
> 1.2.840.113556.1.4.1339,
> 1.2.840.113556.1.4.319, the server does support pagedResultsControl
> 1.2.826.0.1.334810.2.3}
>javax.naming.OperationNotSupportedException: [LDAP: error code 12 - control
>unavailable in context]; remaining name 'ou=groups,dc=mydomain,dc=com'
> at com.sun.jndi.ldap.LdapCtx.mapErrorCode(Unknown Source)
> at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
> at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
> at com.sun.jndi.ldap.LdapCtx.searchAux(Unknown Source)
> at com.sun.jndi.ldap.LdapCtx.c_search(Unknown Source)
> at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_search(Unknown Source)
> at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(Unknown Source)
> at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.search(Unknown Source)
> at javax.naming.directory.InitialDirContext.search(Unknown Source)
> at com.gft.tk.model.database.ldap.TestLdap.testFetching(TestLdap.java:240)
>
>The exception I get in the call of ctx.search(...).
>The message I think means that the server doesn't support pagedResultsControl.
>
>This is a contradiction to the received list of supported controls.
>What's the matter?