G
Guest
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
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