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

Problem when add more value to userCertificate attribute...



Hello, all :
   I am trying set up a java application that connect to a Openldap
2.0.11. I need to add new entry and new attribute value by using that
java application. I have successful add new entry to the ldap server.
But, the problem occur when i try to add another value to a attribute
called userCertificate. I get the following Exception :

Exception in thread "main"
javax.naming.directory.InvalidSearchFilterException: [LDAP: error code
18 - modify: add value failed]; ....

The following is sub of the java code that i used :

....
public static void LDAPAddAttr ( String dn,
                                                    String attr,
                                                    Object attrValue)
throws LDAPException {
    DirContext ctx = new InitialDirContext(env);
    Attributes newAttr = new BasicAttributes(attr, attrValue);
    ctx.modifyAttributes ( dn, DirContext.ADD_ATTRIBUTE, newAttr );
   } catch {Exception e} {
        throw new LDAPException(e);
}

public static void main(String[] args) throws LDAPException {
    byte[] userCert = null;

    userCert = ReadCertFile("test.der");

    ....

    LDAPAddAttr("cn=test;c=SG", "userCertificate;binary", userCert);
    System.out.println("success");
}

Can anyone tell me what's wrong with my java code ? Can userCertificate
attribute accept more than one value ?

Regards,
Siok Peng