Results 1 to 2 of 2

Thread: SchemaViolationException

  1. #1
    Join Date
    Jan 2008
    Location
    Lahore, Pakistan
    Posts
    18

    Question SchemaViolationException

    hi,

    i want to change (update) password of user, i am using OpenLDAP server, i am using following method for changing password.

    CODE :

    public void changePassword(String uid){

    String newPassword = "spring";
    DistinguishedName dN = new DistinguishedName();
    dN.add("uid", "clientAdmin");
    DirContextOperations context = ldapTemplate.lookupContext(dN);

    try {

    context.setAttributeValues("objectclass", new String[] {"top", "inetOrgPerson"});
    context.setAttributeValue("cn", uid);
    context.setAttributeValue("uid", uid);
    context.setAttributeValue("userPassword", SHA1(newPassword));
    ldapTemplate.modifyAttributes(context);
    } catch(Exception e){
    e.printStackTrace();
    }
    }


    But in context.setAttributeValue(xxx) i am not setting all attributes, just these 3 with new password, but while update using LDAP Template i got an exception

    Exception

    org.springframework.ldap.SchemaViolationException: [LDAP: error code 65 - attribute 'gidNumber' not allowed]; nested exception is javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - attribute 'gidNumber' not allowed]; remaining name 'uid=clientAdmin'
    Caused by: javax.naming.directory.SchemaViolationException: [LDAP: error code 65 - attribute 'gidNumber' not allowed]; remaining name 'uid=clientAdmin'
    at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.jav a:3016)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCt x.java:2931)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCt x.java:2737)
    at com.sun.jndi.ldap.LdapCtx.c_modifyAttributes(LdapC tx.java:1437)
    at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_mod ifyAttributes(ComponentDirContext.java:255)
    at com.sun.jndi.toolkit.ctx.PartialCompositeDirContex t.modifyAttributes(PartialCompositeDirContext.java :172)
    at javax.naming.directory.InitialDirContext.modifyAtt ributes(InitialDirContext.java:153)
    at org.springframework.ldap.core.LdapTemplate$19.exec uteWithContext(LdapTemplate.java:969)
    at org.springframework.ldap.core.LdapTemplate.execute WithContext(LdapTemplate.java:807)
    at org.springframework.ldap.core.LdapTemplate.execute ReadWrite(LdapTemplate.java:802)
    at org.springframework.ldap.core.LdapTemplate.modifyA ttributes(LdapTemplate.java:967)
    at org.springframework.ldap.core.LdapTemplate.modifyA ttributes(LdapTemplate.java:1338)


    Can any body plz tell me about some solution.

    thanks

    Kashif Bashir

    kashefbasher@gmail.com

  2. #2
    Join Date
    Jul 2005
    Location
    Helsingborg, Sweden
    Posts
    504

    Default

    You should look at the example code in this post, and replace MD5 with SHA1.
    Ulrik Sandberg
    Jayway (www.jayway.com)
    Spring LDAP project member

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •