I am trying to create an LDAP user with a single custom attribute, but I am getting a
javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - 0000207D: UpdErr: DSID-0315166D, problem 6002 (OBJ_CLASS_VIOLATION), data -2131045114
When I remove the userId custom attribute from the code, it runs perfectly and so that i can create the user, but this custom attribute is used by a third party app and I should create it with this attribute for sure.
Can you give me any idea about what is going on with this attribute? What can be the problem? Thanks
Here is the code that i am getting the error:
Attributes container = new BasicAttributes();
Attribute objClasses = new BasicAttribute("objectClass");
objClasses.add("top");
objClasses.add("person");
objClasses.add("organizationalPerson");
objClasses.add("user");
this.cnValue = new StringBuffer(firstName).append(" ").append(lastName).toString();
Attribute cn = new BasicAttribute("cn", cnValue);
Attribute sAMAccountName = new BasicAttribute("sAMAccountName", userName);
Attribute principalName = new BasicAttribute("userPrincipalName", userName + "@" + DOMAIN_NAME);
Attribute givenName = new BasicAttribute("givenName", firstName);
Attribute sn = new BasicAttribute("sn", lastName);
Attribute uid = new BasicAttribute("uid", userName);
Attribute sshPublicKey = new BasicAttribute("sshPublicKey", "AAAAAAAAAAAAAAAAAAAAAAAA");
Attribute userPassword = new BasicAttribute("userpassword", password);
container.put(objClasses);
container.put(sAMAccountName);
container.put(principalName);
container.put(cn);
container.put(sn);
container.put(givenName);
container.put(uid);
container.put(userPassword);
container.put(sshPublicKey);
container.put("loginId", "aaa"); //When I remove this, user can be created successfully
this.context.createSubcontext(getUserDN(cnValue, organisationUnit), container);