Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

JNDI problem adding multiple attribute in MSAD

Thread view: 
nospam - 06 Jan 2006 00:49 GMT
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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.