ObjectClass Violation
Hi
I am trying to add a new attributeType as well as new object class and I am getting "objectClass violation" error. I have looked closely to syntax and I can not spot anything wrong with the ldif file. Any ideas:
command:
=========
ldapmodify -h host -p port -D "cn=Directory Manager" -w password 杅 filename
filename.ldif:
=========
dn: cn=schema
objectClass: top
objectClass: ldapSubentry
objectClass: subschema
cn: schema
changeType: modify
add: attributeTypes
attributeTypes: ( mynewAtt1-oid NAME 'myNewAtt' DESC 'my New test attribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' )
-
add: objectclasses
objectclasses: ( mynewobject-oid NAME 'TestObjectClass' DESC 'Structural class extending Person object class' SUP inetOrgPerson STRUCTURAL MAY( myNewAtt) X-origin 'Test object class')
error description:
=============
modifying entry cn=schema
ldap_modify_s: Object class violation
Please note that there is no funny character (including new line, tab, etc)in the attibuteTypes and objectTypes and there are all in one line.
Regards
Bob
[1237 byte] By [
besharat] at [2007-11-26 10:19:23]

# 1
This should work with a Sun Directory Server:
dn: cn=schema
changeType: modify
add: attributeTypes
attributeTypes: (mynewAtt-oid NAME 'myNewAtt' DESC 'my New test attribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' )
-
add: objectclasses
objectclasses: (TestObjectClass-oid NAME 'TestObjectClass' DESC 'Structural class extending Person object class' SUP inetOrgPerson STRUCTURAL MAY( myNewAtt) X-origin 'Test object class' )
Stefan
# 2
Thank you for your recent suggestion. I have tried that already and getting:modifying entry cn=schemaldap_modify_s: Invalid syntaxError.Any additional thoughts anyone?RegardsBob
# 3
The LDIF specification mandate an initial space for continued lines.
Try this, it worked with my testing version of Directory Server 6.0 ;-)
dn: cn=schema
changeType: modify
add: attributeTypes
attributeTypes: (mynewAtt-oid NAME 'myNewAtt' DESC 'my New test attribute'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user
defined' )
-
add: objectclasses
objectclasses: (TestObjectClass-oid NAME 'TestObjectClass' DESC
'Structural class extending Person object class' SUP inetOrgPerson
STRUCTURAL MAY ( myNewAtt ) X-origin 'Test object class' )
-
# 4
The joyce of HTML... Spaces are disappearing :-(
2nd try.
> The LDIF specification mandate an initial space for
> continued lines.
> Try this, it worked with my testing version of
> Directory Server 6.0 ;-)
dn: cn=schema
changeType: modify
add: attributeTypes
attributeTypes: (mynewAtt-oid NAME 'myNewAtt' DESC 'my New test attribute'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN
'user defined' )
-
add: objectclasses
objectclasses: (TestObjectClass-oid NAME 'TestObjectClass' DESC
'Structural class extending Person object class' SUP inetOrgPerson
STRUCTURAL MAY ( myNewAtt ) X-origin 'Test objectclass' )
-
# 5
Many thanks for suggestions. I did have the leading blank line in my ldif file. However, I tried it again using cut and paste of your suggestion. No difference.
same error:
=========
ldapmodify: invalid format (line 5 of entry: cn=schema)
Any additional thought?
Regards
Bob
# 6
Bob, are you using a Sun Directory Server and are you using the ldapsearch utility that comes with the DS?
The modify instructions provided by Ludovic and those I did provide earlier to you are correct and do work as you can see below.
[root@localhost bin]# pwd
/opt/s1/ds/shared/bin
[root@localhost bin]# ../../bin/slapd/server/ns-slapd -v
Sun Microsystems, Inc.
Sun Java(TM) System Directory Server/5.2_Patch_4 B2005.230.0415
[root@localhost bin]# ./ldapmodify -v -p 390 -D cn="Directory Manager" -w - -f
/tmp/lall.ldif
Enter bind password:
ldapmodify: started Tue Sep 26 15:38:10 2006
ldap_init( localhost, 390 )
add attributeTypes:
(mynewAtt-oid NAME 'myNewAtt' DESC 'my New test attribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' )
add objectclasses:
(TestObjectClass-oid NAME 'TestObjectClass' DESC 'Structural class extending Person object class' SUP inetOrgPerson STRUCTURAL MAY( myNewAtt) X-origin 'Test object class' )
modifying entry cn=schema
modify complete
[root@localhost bin]# cat /tmp/lall.ldif
dn: cn=schema
changeType: modify
add: attributeTypes
attributeTypes: (mynewAtt-oid NAME 'myNewAtt' DESC 'my New test attribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' )
-
add: objectclasses
objectclasses: (TestObjectClass-oid NAME 'TestObjectClass' DESC 'Structural class extending Person object class' SUP inetOrgPerson STRUCTURAL MAY( myNewAtt) X-origin 'Test object class' )
[root@localhost bin]#
# 7
Hi
Thanks again for your time. I am on the directory server logged in as root and here are some of the config values:
iamuts06# which ldapmodify
/usr/bin/ldapmodify
iamuts06# /export/apps/Sun/mps/bin/slapd/server/ns-slapd -v
Sun Microsystems, Inc.
Sun Java(TM) System Directory Server/5.2_Patch_4 B2005.230.0041
iamuts06# pwd
/export/apps/Sun/mps/slapd-iamuts06/config/schema
iamuts06#
iamuts06# ldapmodify -v -h hostname -p 389 -D "cn=Directory Manager" -w passwd -f bob2.ldif
add cn:
schema
add changeType:
modify
add add:
attributeTypes
add attributeTypes:
( bobnewAtt1-oid NAME 'BobnewAtt' DESC 'Date of Birth' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'user defined' )
add objectclasses:
( mynewobject-oid NAME 'TestObjectClass' DESC 'Structural class extending Person object class' SUP inetOrgPerson STRUCTURAL MAY( BobNewAtt) X-origin 'Initial Architectural team- CSC.')
modifying entry cn=schema
ldap_modify_s: Invalid syntax
Regards
Bob
# 8
Try this:$ cd /export/apps/Sun/mps/shared/bin$ ./ldapmodify -v -h hostname -p 389 -D "cn=Directory Manager" -w passwd -f lall.ldifStefan
# 9
That did it. Many Many thx. Bob