javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name 'cn=denis

lhxzgw 2009-02-14 11:16:07
我想添加节点到ldap目录下,但是总报错:
Exception in add():javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name 'cn=denis,dc=lily,dc=com'
下面是添加节点的方法代码,请大家帮忙看看哪有问题啊(服务器认证已成功)
public static void add(){
try{
String newUserName = "denis";

Attributes attrs = new BasicAttributes(true);
Attribute objclassSet = new BasicAttribute("objectclass");
objclassSet.add("top");
objclassSet.add("person");
attrs.put(objclassSet);
attrs.put(new BasicAttribute("cn", newUserName));
attrs.put(new BasicAttribute("sn", newUserName));

ctx.createSubcontext("cn=" + newUserName + ",dc=lily,dc=com", attrs); //添加一个节点

}catch(Exception e){
System.out.println("Exception in add():"+e);
}
}
...全文
3014 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
  • 打赏
  • 举报
回复
也碰到相同的问题了,你解决了吗?
qianyexia2008 2011-02-22
  • 打赏
  • 举报
回复
ctx.createSubcontext("cn=" + newUserName + ",dc=lily,dc=com", attrs);
改为 ctx.createSubcontext("cn=" + newUserName , attrs);
注释掉行“ attrs.put(new BasicAttribute("cn", newUserName)); ”
lhxzgw 2009-02-16
  • 打赏
  • 举报
回复
唉,怎么没人响应呢?
程序又出现新的问题了!
在服务器认证时,原来的程序认证授权是simple,后来认证授权改为none时出现下面错误:
Exception in add():javax.naming.AuthenticationNotSupportedException: [LDAP: error code 8 - modifications require authentication]; remaining name 'cn=denis,dc=lily,dc=com'
认证授权改为strong时出现下面错误:
javax.naming.AuthenticationNotSupportedException: strong
这又是怎么回事呢?
cjmiou 2009-02-14
  • 打赏
  • 举报
回复
up

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧