Announcement Announcement Module
No announcement yet.
unable to add new users to existing group Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • unable to add new users to existing group


    Iam using spring ldap to communicate with AD...I have some function to get data from AD as well as to post some data to AD...all my search functions by using is working very fine but ldapTemplate.bind() is not working....

    I want to add new users to an existing group by using ldapTemplate.bind()...I am getting the values form a form and created a DirContextAdapter object by passing the DistinguishedName to it...and then I used DirContextAdapter's setter methods to set attribute values...but it is throwing javax.naming.NameAlreadyBoundException: [LDAP: error code 68 - 00002071: UpdErr: DSID-03050328, problem 6005 (ENTRY_EXISTS), data 0...

    please help me to resolve this...

    here my code
    <bean id="contextSource" class=" ontextSource">
    <property name="url" value="ldap\://\:389" />
    <property name="base" value="dc\=THINKDESK,dc\=IN" />
    <property name="userDn" value="[email protected]" />
    <property name="password" value="password}" />
    <property name="pooled" value="false"></property>


    <bean id="ldapTemplate" class="org.springframework.ldap.core.LdapTemplate" >
    <constructor-arg ref="contextSource" />

    <property name="ignorePartialResultException" value="true"></property>

    Java Code:

    public void addLdapUser(LdapUser lUser) {

    DirContextAdapter luadapter=new DirContextAdapter(dn);
    luadapter.setAttributeValue("givenName",lUser.getF irst_name());
    luadapter.setAttributeValue("sn", lUser.getLast_name());
    luadapter.setAttributeValue("mail", lUser.getEmail_id());
    luadapter.setAttributeValue("description", tRole());
    luadapter.setAttributeValue("company", lUser.getOrganization());
    luadapter.setAttributeValue("st",lUser.getState()) ;
    luadapter.setAttributeValue("co", lUser.getCountry());
    luadapter.setAttributeValue("homePhone", lUser.getPhone());
    luadapter.setAttributeValue("telephoneNumber", lUser.getMobile());
    luadapter.setAttributeValue("userPrincipalName", lUser.getCn());
    luadapter.setAttributeValue("sAMAccountName",lUser .getCn());

    luadapter.setAttributeValue("displayName", lUser.getCn());
    Object[]oc={"top","person","organizationalPerson","user"," inetOrgPerson"};
    luadapter.setAttributeValues("objectClass", oc);


    Error stacktrace:

    Mar 24, 2012 8:50:01 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet [appServlet] in context with path [/ldap] threw exception [Request processing failed; nested exception is org.springframework.ldap.NameAlreadyBoundException : [LDAP: error code 68 - 00002071: UpdErr: DSID-03050328, problem 6005 (ENTRY_EXISTS), data 0


  • #2
    I have tried so many alternatives..but no this problem of in my configuration I am getting plain LDAP connection("ldap\://\:389") and if I try to get connection as ("ldaps\://\:389"), it is throwing another exception like "simple bind failed reset"....

    please provide some help....