问简单一点。就是增加目录的时候。这些参数该怎么设置啊?求求大家了,一定要帮忙啊!!
   String dn = "CN=Jensen,DC=lucheng, DC=gov, DC=cn";
lucheng.gov.cn是我现在的活动目录的根。我想问,添加的时候,cn,sn,ou是不是可以随便写啊??
===========================
               LDAPAttribute attr = new LDAPAttribute( "objectclass" );
                for( int i = 0; i < objectclass_values.length; i++ ) {
                        attr.addValue( objectclass_values[i] );
                }
我想问一下,这里objectclass_values这个数组该怎么定义啊。
我写成这样(包括注释掉的也用过)String objectclass_values[] = { "Person"};//, "organizationalPerson","inetOrgPerson","foobarPerson"};可总是不行,报告属性不正确。链接和绑定是可以了,可就是增加不行。我已经折磨的快不行了。求求大伙,怎么办啊?
=================================
我现在的程序这样的:
package ldapcon;
/*
 * Copyright (c) 1997.  Netscape Communications Corporation.  All
 * rights reserved.
 *
 * Add a new entry to the directory.
 *
 * Since it is an error to attempt to add an entry which already exists,
 * you cannot run this example program twice in a row.  You can use the
 * del.java example program to delete the entry which this example adds.
 *
 */import netscape.ldap.*;
import java.util.*;public class Add {
    public static void main( String[] args )
        {
                /* Specify the DN we're adding */
                String dn = "CN=Jensen, CN=Users,DC=lucheng, DC=gov, DC=cn";//uid=wbjensen                /* Specify the attributes of the entry */
                String objectclass_values[] = { "Person"};//, "organizationalPerson","inetOrgPerson","foobarPerson"};
                String cn_values[] = { "William B Jensen"};
                String sn_values[] = { "Jensen" };
                String givenname_values[] = { "William"};
                String telephonenumber_values[] = { "+1 415 555 1212" };                LDAPAttributeSet attrs = new LDAPAttributeSet();
               LDAPAttribute attr = new LDAPAttribute( "objectclass" );
                for( int i = 0; i < objectclass_values.length; i++ ) {
                        attr.addValue( objectclass_values[i] );
                }
                 attrs.add( attr );
                  attr = new LDAPAttribute( "cn" );
                for( int i = 0; i < cn_values.length; i++ ) {
                        attr.addValue( cn_values[i] );
                }
                attrs.add( attr );
                attr = new LDAPAttribute( "sn" );
                for( int i = 0; i < sn_values.length; i++ ) {
                        attr.addValue( sn_values[i] );
                }
                attrs.add( attr );
  /*             attr = new LDAPAttribute( "givenname" );
                for( int i = 0; i < givenname_values.length; i++ ) {
                        attr.addValue( givenname_values[i] );
                }
                attrs.add( attr );
                attr = new LDAPAttribute( "telephonenumber" );
                for( int i = 0; i < telephonenumber_values.length; i++ ) {
                        attr.addValue( telephonenumber_values[i] );
                }
                attrs.add( attr );
               attrs.add( new LDAPAttribute( "uid", "wbjensen" ) );
*/
                /* Create an entry with this DN and these attributes */
                LDAPEntry myEntry = new LDAPEntry( dn, attrs );                LDAPConnection ld = null;
                int status = -1;
                try {
                        ld = new LDAPConnection();
                        /* Connect to server */
                        String MY_HOST = "192.168.102.69";
                        int MY_PORT = 389;
                        ld.connect( MY_HOST, MY_PORT );                        /* Authenticate to the server as directory manager */
                        String MGR_DN = "CN=Administrator,CN=Users,DC=lucheng,DC=gov,DC=cn";
                        String MGR_PW = "mail";
                        ld.authenticate( MGR_DN, MGR_PW );                        /* Now add the entry to the directory */
                        ld.add( myEntry );
                        System.out.println( "Entry added"  );
                }
                catch( LDAPException e ) {
                        if ( e.getLDAPResultCode() == LDAPException.ENTRY_ALREADY_EXISTS )
                                System.out.println( "Error: Entry already present" );
                        else
                                System.out.println( "Error: " + e.toString() );
                }                /* Done, so disconnect */
                if ( (ld != null) && ld.isConnected() ) {
                        try {
                            ld.disconnect();
                        } catch ( LDAPException e ) {
                                System.out.println( "Error: " + e.toString() );
                        }
                }
                System.exit(status);
    }
}
==运行后报告这个错误,我也不知道怎么办了。救命啊!!!
Error: netscape.ldap.LDAPException: error result (53); 000020A7: SvcErr: DSID-0305046D, problem 5003 (WILL_NOT_PERFORM), data 0
=====
我的活动目录很简单的。就是根目录是lucheng.gov.cn,然后下面有个Users目录,下面就是用户了。怎么才能加入用户呢?求求大家啦谁救我?500分相谢!