Announcement Announcement Module
No announcement yet.
Entry not found exception Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Entry not found exception

    Hii all, I am getting Entry not found; [LDAP: error code 32 ] exception while binding data

    the following is my Dao implementation:

    public static final String BASE_DN = "ou=system";

    public void create(User user) {
    Name dn = buildDn(user);
    ldapTemplate.bind(dn, null, buildAttributes(user));

    private Attributes buildAttributes(User user) {
    Attributes attrs = new BasicAttributes();
    BasicAttribute ocattr = new BasicAttribute("objectclass");
    attrs.put("cn", "person");
    attrs.put("telephonenumber", user.getUid());
    attrs.put("userPassword", user.getUserPassword());
    return attrs;

    protected Name buildDn(User user) {
    DistinguishedName dn = new DistinguishedName(BASE_DN);
    dn.add("cn", user.getDisplayName());
    dn.add("telephonenumber", user.getUid());
    dn.add("userPassword", user.getUserPassword());

    return dn;

    attached image is my directory, please help me regarding this.

  • #2
    My guess is that the problem is caused by the base DN being included when you build your distinguished name. If you have specified a base path in you ContextSource configuration, that base should never be included in any DNs in your program.


    • #3
      here is my context definition :

      <bean id="contextSource"
      class=" tSource">
      <property name="url" value="ldap://localhost:10389" />
      <property name="userName" value="uid=admin,ou=system" />
      <property name="password" value="secret" />

      the following exception i am getting while binding data:

      org.springframework.ldap.EntryNotFoundException: Entry not found; nested exception is javax.naming.NameNotFoundException: [LDAP: error code 32 - failed to add entry userpassword=test,sn=123,cn=test,ou=system: Parent sn=123, cn=test, ou=system not found]; remaining name 'userpassword=test, sn=123, cn=test, ou=system'
      org.springframework.ldap.DefaultNamingExceptionTra nslator.translate(DefaultNamingExceptionTranslator .java:51)
      org.springframework.ldap.LdapTemplate.executeWithC ontext(


      • #4
        Ah, sorry, I wasn't looking close enough...

        I think you've misunderstood the DN concept. The DN is for identifying the entry - the prmary key if you will. You then specify Attributes to bind to the DN. In your example you are adding Attributes to your DN.

        For more information on basic LDAP concepts, this introduction looks pretty good.