[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: LDAP Add with Netscape SDK for Java



In the slpad.conf, your Directory Manager is

>rootdn          "cn=Manager, dc=tls-us, dc=com"

However, you try to authenticate by the following wrong DN,

>//  String MGR_DN = "cn=Manager,ou=tls-us,o=com";  // <== I tried this too!
>  String MGR_DN = "cn=Manager";
>  String MGR_PW = "secret";
>
>  System.out.println( "1.) Debugging!" );
>  ld.authenticate( MGR_DN, MGR_PW );

So, modify the MGR_DN to "cn=Manager, dc=tls-us, dc=com", then you
can add the new entry successfully!

--------------------------------------------------------
Shih-Chang Wang
Associate Researcher
Internet & Multimedia Application Tech. Lab.
ChungHwa Telecom Laboratories
E-MAIL: purewang@cht.com.tw
TEL: 03-4245340
FAX: 03-4201244
--------------------------------------------------------
-----­ì©l¶l¥ó-----
±H¥óªÌ: Wes Quinn <wes.quinn@tls-us.com>
¦¬¥óªÌ: openldap-software@OpenLDAP.org <openldap-software@OpenLDAP.org>
¤é´Á: 2001¦~7¤ë20¤é PM 08:47
¥D¦®: LDAP Add with Netscape SDK for Java


>I'm new to LDAP and I'm trying to get OpenLDAP 2.0.12 working with Netscape
>SDK for Java version 4.0.  I haven't been able to add any entries yet.
>
>I'm getting an error on the ld.connect call in the Add.java file.  This is
>what gets printed to the screen.  I added debug statements so I know
exactly
>where the exception was being raised:
>1.) Debugging!
>Error: netscape.ldap.LDAPException: error result (49); Invalid credentials
>
>
>Here is a small section of the code.
>/* 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 = "localhost";
>  int MY_PORT = 389;
>  ld.connect( MY_HOST, MY_PORT );
>
>  /* Authenticate to the server as directory manager */
>//  String MGR_DN = "cn=Manager,ou=tls-us,o=com";  // <== I tried this too!
>  String MGR_DN = "cn=Manager";
>  String MGR_PW = "secret";
>
>  System.out.println( "1.) Debugging!" );
>  ld.authenticate( MGR_DN, MGR_PW );
>  System.out.println( "2.) Debugging!" );
>
>  /* 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() );  // <== Prints out the
>error msg here! ***
>  }
>
>
>Here is a copy of my slapd.conf file:
># $OpenLDAP: pkg/ldap/servers/slapd/slapd.conf,v 1.8.8.4 2000/08/26
17:06:18
>kurt Exp $
>#
>include         /etc/openldap/schema/core.schema
>include         /etc/openldap/schema/cosine.schema
>include         /etc/openldap/schema/inetorgperson.schema
>include         /etc/openldap/schema/nis.schema
>include         /etc/openldap/schema/redhat/rfc822-MailMember.schema
>include         /etc/openldap/schema/redhat/autofs.schema
>include         /etc/openldap/schema/redhat/kerberosobject.schema
>
>#######################################################################
># ldbm database definitions
>#######################################################################
>database        ldbm
>suffix          "dc=tls-us, dc=com"
>rootdn          "cn=Manager, dc=tls-us, dc=com"
>rootpw          secret
>directory       /var/lib/ldap
>
>index   objectClass,uid,uidNumber,gidNumber     eq
>index   cn,mail,surname,givenname               eq,subinitial
>
>defaultaccess read
>access to attr=userpassword
> by self write
> by dn="cn=Manager,dc=tls-us,dc=com" write
> by * compare
>access to *
> by dn="cn=Manager,dc=tls-us,dc=com" write
> by * read
>
>
>I ran this test to verify that everything was installed properly:
>java LDAPSearch -x -b '' -s base '(objectclass=*)' namingContexts
>
>
>The results I got back were:
>dn:
>namingContexts: dc=tls-us,dc=com
>
>And that is correct, so it looks to be set up properly, but I'm not sure
>about the slapd.conf file.
>
>Any help would be greatly appreciated!
>
>Thanks,
>Wes Quinn
>Translogic Systems, Inc.
>
>