Hi, I have created an attribute in LDAP using the following code.
attrs.put("NUMERICOID", "1.3.6.1.4.1.42.2.27.4.2.3.1.1.9");
attrs.put("NAME", "myattribute");
attrs.put("DESC", "for JNDITutorial example only");
attrs.put("SYNTAX", "1.3.6.1.4.1.1466.115.121.1.15");
DirContext schema = context.getSchema("");
DirContext newAttr = schema.createSubcontext ("AttributeDefinition/myattribute1", attrs);
The attribute is created successfully, Now I am trying to add this attribute to a user say "user1"(uid).
Attributes attributeslist = context.getAttributes(ld.getUserDN(username));
attributeslist.put("myattribute1", "");
context.modifyAttributes(ld.getUserDN("test5"), DirContext.REPLACE_ATTRIBUTE, attributeslist);
But it gives me object class violation error.
Can anyone help me to solve this? I need to add an user defined attribut to the user using java code.