I want to create new User in NetIQ eDirectory with Group Membership attribute.
I can create the user without Group Membership attribute but when I try to create new user with Group Membership attribute it gives me the below error
Code:
javax.naming.directory.AttributeInUseException: [LDAP: error code 20 - NDS error: duplicate value (-614)]; remaining name 'cn=tuser08,ou=users,o=data'
My Java code is given below
Code:
public static boolean addUser(UserObjects userObj, DirContext eDirConn) {
	try {
		ArrayList<String> memberOf=new ArrayList<String>();
		memberOf.add("cn=Access_Delegate,ou=groups,o=data");
		memberOf.add("cn=Access_Basic,ou=groups,o=data");

		String ldapSearchBase = ",ou=users,o=data";
		Attribute objClasses = new BasicAttribute("objectClass");
		objClasses.add("inetOrgPerson");

		BasicAttribute groupArr = new BasicAttribute("groupMembership");
		for (String strGroup : memberOf) {
			groupArr.add(strGroup);
		}

		String cnValue = "tuser08";
		Attributes container = new BasicAttributes();
		container.put(objClasses);
		container.put("cn", cnValue);
		container.put("sn", userObj.sn);
		container.put("userPassword", userObj.password);
		container.put(groupArr);

		String userDN = "cn=" + cnValue + ldapSearchBase;
		eDirConn.createSubcontext(userDN, container);
	} catch (Exception e) {
		System.out.println("Exception : " + e);
	}
	return false;
}
I am using Java (jdk1.8.0_60) and NetIQ eDirectory 8.8 SP8 v20810.20.