Results 1 to 2 of 2

Thread: unable to add new users to existing group

Hybrid View

  1. #1
    Join Date
    Apr 2012
    Posts
    7

    Default unable to add new users to existing group

    hi...

    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 ldapTemplate.search() 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
    Configuration:
    <bean id="contextSource" class="org.springframework.ldap.core.support.LdapC ontextSource">
    <property name="url" value="ldap\://xxx.xxx.123.10\:389" />
    <property name="base" value="dc\=THINKDESK,dc\=IN" />
    <property name="userDn" value="administrator@thinkdesk.in" />
    <property name="password" value="password}" />
    <property name="pooled" value="false"></property>

    </bean>

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

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


    </bean>
    Java Code:

    public void addLdapUser(LdapUser lUser) {

    DirContextAdapter luadapter=new DirContextAdapter(dn);
    System.out.println("dn"+dn.toString());
    luadapter.setAttributeValue("givenName",lUser.getF irst_name());
    luadapter.setAttributeValue("sn", lUser.getLast_name());
    luadapter.setAttributeValue("cn",lUser.getCn());
    luadapter.setAttributeValue("mail", lUser.getEmail_id());
    luadapter.setAttributeValue("description",lUser.ge tRole());
    luadapter.setAttributeValue("company", lUser.getOrganization());
    luadapter.setAttributeValue("l",lUser.getCity());
    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);


    ldapTemplate.bind(luadapter);


    }
    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



    PLEASE HELP....

  2. #2
    Join Date
    Apr 2012
    Posts
    7

    Default

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

    please provide some help....

Posting Permissions

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