Hi, I'm using JNDI to update an Active Directory. Now I'm facing the
following problem:
When I try to add a value to a multiple attribute (department), I get
the following error:
20:59:11,390 FATAL [LdapSlave.java:95] [LDAP: error code 19 - 00002081:
AtrErr: DSID-031D0809, #1:
0: 00002081: DSID-031D0809, problem 1005 (CONSTRAINT_ATT_TYPE), data 0,
Att d (description)
It doesn't happen when I add or update a single value attribute.
The snippet for the update is as follows:
private void UpdateRegister(Hashtable db2Hash,String dn) {
for (Iterator it=db2Hash.entrySet().iterator(); it.hasNext(); ) {
Map.Entry entry = (Map.Entry)it.next();
String key = (String)entry.getKey();
String value = (String)entry.getValue();
String ldapvalue = (String)ldapValsTable.get(key);
ModificationItem[] mods=null;
boolean doMod = false;
if ( value.length() == 0 && ldapvalue == null ) {
continue;
}
if ( ldapvalue == null && value.length() > 0 ){
l.info("atributo \""+key+"\" no existe, creandolo con valor
\""+value+"\"");
//agregar atributo a ldap ... funciona solo con single-valued
mods = new ModificationItem[1];
mods[0] = new ModificationItem(DirContext.ADD_ATTRIBUTE, new
BasicAttribute(key, value));
doMod=true;
}
else if ( value.length() == 0 && ldapvalue != null ){
mods = new ModificationItem[1];
mods[0] = new ModificationItem(DirContext.REMOVE_ATTRIBUTE,
new BasicAttribute(key));
l.debug("Borrando atributo: "+key);
doMod=true;
}
else if ( value.compareTo(ldapvalue) != 0) {
mods = new ModificationItem[1];
mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE,
new BasicAttribute(key, value));
doMod=true;
l.info("Diferencia encontrada: "+key+":"+value+"/"+ldapvalue);
}
else
l.info("No se encontraron diferencias para : "+key+":"+value);
try {
if ( doMod && !isPreviewOnly )
ctx.modifyAttributes(dn, mods);
} catch (NamingException e) {
l.fatal(e.getLocalizedMessage());
}
}
Any ideas?
Thanks in advance
Lord of the Union - 06 Jan 2006 04:34 GMT
In general this error means that the value you are trying to set for the
attribute is invalid. A very common case of this error is changing
password. In your case, display the actual value of the attribute that
you are using for that attribute. Check to see whether it is a valid
value. You can AD admin tool to set the attribute to the same valeu and
see whether you are able to...
=
> Hi, I'm using JNDI to update an Active Directory. Now I'm facing the
> following problem:
[quoted text clipped - 68 lines]
>
> Thanks in advance
sebas.lillo@gmail.com - 11 Jan 2006 11:42 GMT
I solved it this way:
If the attribute is multiple, the operation MUST be REPLACE_ATTRIBUTE
even if its empty (!!!), otherwise you can use ADD_ATTRIBUTE.
Regards
> In general this error means that the value you are trying to set for the
> attribute is invalid. A very common case of this error is changing
[quoted text clipped - 76 lines]
> >
> > Thanks in advance