我的java程序如下:
public static String MY_SEARCHBASE="dc=example,dc=com";
public static String MY_FILTER="(sn=lh)"; public List SelectUser(String userID) {
List list = new ArrayList();
LdapContextUtil ldapContextUtil = new LdapContextUtil();
DirContext ctx = ldapContextUtil.getContext();
try {
SearchControls sh=new SearchControls();
sh.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration rss=ctx.search(MY_SEARCHBASE,MY_FILTER,sh);
报错为:
javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name 'dc=example,dc=com'请问为什么?如何解决?已经困扰二天了,郁闷中:(
public static String MY_SEARCHBASE="dc=example,dc=com";
public static String MY_FILTER="(sn=lh)"; public List SelectUser(String userID) {
List list = new ArrayList();
LdapContextUtil ldapContextUtil = new LdapContextUtil();
DirContext ctx = ldapContextUtil.getContext();
try {
SearchControls sh=new SearchControls();
sh.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration rss=ctx.search(MY_SEARCHBASE,MY_FILTER,sh);
报错为:
javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name 'dc=example,dc=com'请问为什么?如何解决?已经困扰二天了,郁闷中:(
解决方案 »
- weblogic集群+apache如何设计架构,求中间件高手!
- <s:reset value="重填" />不能重置
- AJAX乱码的问题
- 面向对象的设计问题
- 为什么在tomcat的root目录下不能正常的链接
- Mysql5.0中对字段设置索引后,再通过这两字段设置两表的关联关系时,出现问题,急得很!!!!,高手们来多帮忙帮忙哦!!!!!!!!!!!!!!!!!!!!!!!!!!
- 100分急!怎么判断struts中的FormFile为空?
- jBuilder5如何配置才能支持EJB?
- AsyncContext异步输出报错:java.lang.NullPointerException
- freemarker生成的PDF中含有表格,表格宽度的问题
- 郁闷,放100分,调试RMI有这么麻烦吗?
- 关于jndi与ldap的连接,请大家帮忙看看,谢谢!在线等待!!!!
SearchControls sh=new SearchControls();
DirContext curCtx = (DirContext)ctx.lookup(MY_SEARCHBASE);
NamingEnumeration enum = curCtx.search("", MY_FILTER, ctrls);
while(enum.hasMore()){
}