谢谢
做一个基于ldap的系统急需知道java是如何向ldap中添加条目的代码

解决方案 »

  1.   

    http://faq.csdn.net/read/196460.html
    看看这个FAQ!
      

  2.   

    javax.naming.InvalidNameException:
     currentTime=Mon May 28 16:21:49 CST 2007,nodeAdrress=59.77.227.213,group=g1,dc=guessant,dc=org: [LDAP: error code 34 - invalid DN]; 
    remaining name 'currentTime=Mon May 28 16:21:49 CST 2007,nodeAdrress=59.77.227.213,group=g1,dc=guessant,dc=org'
    这是什么原因报错为什么会有这样的问题?
      

  3.   

    InvalidNameException无效的名字啊
      

  4.   

    http://java.sun.com/docs/books/tutorial/jndi/index.html JNDI和LDAP的指南
    http://www.springframework.org/ldap 提供类似jdbcTemplate的ldap操作
      

  5.   

    向LDAP添加条目时,类似于创建一个对象,需要根据objectClass来创建。
    objectClass定义了对象的具有哪些属性。group=g1,dc=guessant,dc=org应该是不对的,在标准的ldap schema定义中没有用属性group作为RDN的(自己定义当然是可以的),常见用于RDN的在ou,cn这些。
      

  6.   

    把你自己定义的schema贴上来看看。
    继承了哪些objectClass,又添加了哪些属性?
      

  7.   


    attributetype ( 1.1.1.1.1 NAME 'nodeAddress'
    DESC 'nodeAddress of a computer'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )attributetype ( 1.1.1.1.2 NAME 'nodeName'
    DESC 'nodeName of a computer'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )attributetype ( 1.1.1.1.3 NAME 'currentTime'
    DESC 'current time of a computer'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )attributetype ( 1.1.1.1.4 NAME 'ipVersion'
    DESC 'ip version of a computer'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )attributetype ( 1.1.1.1.5 NAME 'cpuUsage'
    DESC 'cpu used rate of a computer'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )attributetype ( 1.1.1.1.6 NAME 'memoryUsed'
    DESC 'used memory of a computer'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )attributetype ( 1.1.1.1.7 NAME 'memoryUsage'
    DESC 'memory used rate of a computer'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )attributetype ( 1.1.1.1.8 NAME 'group'
    DESC 'memory used rate of a computer'
    EQUALITY caseIgnoreMatch
    SUBSTR caseIgnoreSubstringsMatch
    SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )objectclass ( 1.1.1.2.1 NAME 'node'
    DESC 'RFC2256: a computer'
    SUP top STRUCTURAL
    MUST ( nodeAddress $ group )
    MAY ( nodeName $ currentTime $ ipVersion $ cpuUsage $ memoryUsed $ memoryUsage ) )objectclass ( 1.1.1.2.2 NAME 'nodes'
    DESC 'RFC2256: a computer group'
    SUP top STRUCTURAL
    MUST group
    MAY ( currentTime $ ipVersion $ cpuUsage $ memoryUsed $ memoryUsage ) )objectclass ( 1.1.1.2.3 NAME 'resource'
    DESC 'resource of a computer'
    SUP top STRUCTURAL
    MUST ( currentTime $ nodeAddress $ group )
    MAY ( nodeName $ group $ ipVersion $ cpuUsage $ memoryUsed $ memoryUsage ) )
      

  8.   

    代码也贴出来看看吧,我这几天也在做LDAP方面的工作,用的是spring-ldap