• Post Reply Bookmark Topic Watch Topic
  • New Topic

LDAP Sorting  RSS feed

 
K Robert
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can some one help me with sorting? I have the following code:
...
DirContext ctx = new InitialDirContext(env);// get a reference to a directory context

// Create critical Sort that sorts based on givenName
Control[] ctxCtls = new Control[]{
new SortControl(
new String[]{"givenName"}, Control.CRITICAL)
};

// Sets context request controls; effect until
ctx.setRequestControls(ctxCtls);

// begin search
// specify the scope of the search
SearchControls constraints = new SearchControls();
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
...
And I get the following error message:

Generated servlet error:
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
[javac] D:\Program Files\Apache Group\jakarta-tomcat-5\work\Catalina\localhost\sweetheart\org\apache\jsp\phone_005fbook_jsp.java:203: cannot resolve symbol
[javac] symbol : method setRequestControls (javax.naming.ldap.Control[])
[javac] location: interface javax.naming.directory.DirContext
[javac] ctx.setRequestControls(ctxCtls);
[javac] ^
[javac] 1 error

Any clues?
 
XueRong Weng
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have problem on ldap sorting too. But it's a little bit different. It can be compiled successfully. But during run time,
error code 12 occurred:
critical extension is unavailable
Does it mean:
1. my ldap server do not support sorting? (but it should because i can do sorting by using command ldapsearch)
2. my package doesn't support sorting? I'm using javax.naming.*
javax.naming.directory.*
javax.naming.ldap.*
com.sun.jndi.ldap.*
com.sun.jndi.ldap.ctl.*
Thanks a lot!
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!