[Date Prev][Date Next] [Chronological] [Thread] [Top]

How to Add an Entry using JNDI ??




Hi ,

I have my schema given below . When I try to add entries for "people" in the
LDAP schema using JNDI , I get a  NamingException.

dn: dc=walgreens, dc=com
dc: walgreens
o: Walgreens Co.
objectclass: organization
objectclass: dcObject

dn: dc=AuthServ,dc=Walgreens,dc=com
objectclass: top
objectclass: domainComponent
dc: AuthServ

dn: ou=Groups,dc=AuthServ,dc=Walgreens,dc=com
objectclass: top
objectclass: organizationalUnit
ou: Groups

dn: ou=People,dc=AuthServ,dc=Walgreens,dc=com
objectclass: top
objectclass: organizationalUnit
ou: People

dn: cn=xyz,ou=People,dc=AuthServ,dc=Walgreens,dc=com
cn: xyzuid:
ou: People
uid: xyz
objectclass: Person

I created a Java Class for a Person with all required attributes !!!
When I try binding the class given below , I get a NamingException ::

     Person u = new Person("myName","myName","person","People");

     //The above class for assigning the attributes
     //cn: myName
     //ou: People
     //uid: myName
               //objectclass: person

     I have bound the DirCtx variable "ctx" as the Directory Manager who has the
 rights to add , delete and modify attributes
     When I try binding the class given below , I get a NamingException ::

     try
     {

ctx.bind("cn=rajsharm,ou=people,dc=AuthServ,dc=Walgreens,dc=com",u,null);
     }
     catch(NameAlreadyBoundException e)
     {
          System.out.println("Error" + e.getMessage());
          System.out.println("Error" + e.getExplanation());
     }
     catch(InvalidAttributesException e)
     {
          System.out.println("Error" + e.getMessage());
          System.out.println("Error" + e.getExplanation());
     }
     catch(NameNotFoundException e)
     {
          System.out.println("Error" + e.getMessage());
     }
     catch(NamingException e)
     {
          System.out.println("Error" + e.getMessage());
          System.out.println("Error" + e.getExplanation());
     }
     catch(Exception e)
     {
          System.out.println("Error" + e.getMessage());
     }


Any Help will be Highly appreciated !!!


Thanks in Advance !!!


Rajneesh