netscape.ldap.LDAPException: error result (65); Object class violation

i am getting netscape.ldap.LDAPException: error result (65); Object class violation exception when i am trying to add a new attribute of a user into LDAP.

I AM USING FOLLOWING CODE FOR ADDING

LDAPAttribute attr=new LDAPAttribute("nsRole",role);

LDAPAttribute attr1=new LDAPAttribute("uid",uid);

LDAPAttributeSet attrSet=new LDAPAttributeSet();

attrSet.add(attr);

attrSet.add(attr1);

LDAPEntry myEntry = new LDAPEntry( addUserDN, attrSet);

ldapconn.add(myEntry);

any help would be appreciated

[552 byte] By [aravind_vaishnavama] at [2007-11-27 9:15:36]
# 1

Your directory server has schema checking enabled (which is good).

You need to extend the schema of the objectclass that you are dealing with by adding the attribute you want to populate.

On the directory server console, go to Configuration>Schema, go to the objectclass that you want to modify, and add the attribute to its schema.

Once this is done, you shouldn't get this error.

Ankush

ankushkapoora at 2007-7-12 22:04:45 > top of Java-index,Web & Directory Servers,Directory Servers...
# 2
But we don't have a directory server console.Can we do the same through command prompt?
aravind_vaishnavama at 2007-7-12 22:04:45 > top of Java-index,Web & Directory Servers,Directory Servers...
# 3

Yes you can use ldapmodify to change the schema ........but you will have to create an ldif

dn: cn=schema

changetype: modify

add: attributetypes

attributeTypes: ( attrname-oid NAME 'attrname' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' )

and import it

anujeveretta at 2007-7-12 22:04:45 > top of Java-index,Web & Directory Servers,Directory Servers...