No, skis[0] = new javax.naming.ldap.SortKey(sortKey,false,null); too does not work.
I hope the other params are correct. I thought attrID is equivalent to attribute name and passed "cn" as the 1st argument to SortKey. Thanks Neha On Mon, Nov 10, 2014 at 10:11 AM, Emmanuel Lécharny <[email protected]> wrote: > Le 10/11/14 05:26, Neha Rawat a écrit : > > With JNDI, I defined the sortKey like this -- > > String sortKey = "cn"; > > javax.naming.ldap.SortKey[] skis = new > > javax.naming.ldap.SortKey[1]; > > skis[0] = new javax.naming.ldap.SortKey(sortKey,true,null); > > SortControl sortControl = new SortControl(skis, > > Control.CRITICAL); > > ctx.setRequestControls(new Control[] { sortControl }); > > > > But I get the same exception in this case too. > > I'm afraid JNDI is just sending a Control omitting the reverseOrder flag > when it's set to false (this is teh default value, so you can omit it). > > Does it work when you set use this code ? : > > String sortKey = "cn"; > javax.naming.ldap.SortKey[] skis = new > javax.naming.ldap.SortKey[1]; > skis[0] = new javax.naming.ldap.SortKey(sortKey,false,null); > // This time, use the reverse order > SortControl sortControl = new SortControl(skis, > Control.CRITICAL); > ctx.setRequestControls(new Control[] { sortControl }); > > > Thanks ! > > -- Love and Luck, Neha
