title: LDAP error: invalid structural object class chain (organizationalUnit/referral)
body: <p>I am trying to import the following sample from <a href="http://docs.oracle.com/javase/jndi/tutorial/ldap/referral/jndi.html" rel="nofollow">Oracle's JNDI tutorial </a> in my OpenLDAP instance using command:</p>
  
  <pre><code>ldapadd -x -D cn=admin,dc=example,dc=com -W -f refserver.ldif
  </code></pre>
  
  <p>where, <code>refserver.ldif</code> looks like this:</p>
  
  <pre><code>dn: o=JNDITutorial,dc=example,dc=com
  o: JNDITutorial
  objectclass: top
  objectclass: organization
  
  dn: ou=All, o=JNDITutorial,dc=example,dc=com
  ou: All
  objectclass: top
  objectclass: organizationalunit
  
  dn: ou=People, o=JNDITutorial,dc=example,dc=com
  ou: People
  objectclass: top
  objectclass: organizationalunit
  objectclass: referral
  ref: ldap://10.97.98.201:389/ou=People,o=JNDITutorial
  
  dn: ou=People, ou=All, o=JNDITutorial,dc=example,dc=com
  ou: People
  objectclass: top
  objectclass: organizationalunit
  objectclass: referral
  ref: ldap://10.97.98.201:389/ou=People,o=JNDITutorial
  
  dn: ou=NewHires, ou=All, o=JNDITutorial,dc=example,dc=com
  ou: NewHires
  objectclass: top
  objectclass: organizationalunit
  objectclass: referral
  ref: ldap://10.97.98.201:389/ou=NewHires,o=JNDITutorial
  </code></pre>
  
  <p>This runs into partial success, reporting the following:</p>
  
  <pre><code>adding new entry "o=JNDITutorial,dc=example,dc=com"
  
  adding new entry "ou=All, o=JNDITutorial,dc=example,dc=com"
  
  adding new entry "ou=People, o=JNDITutorial,dc=example,dc=com"
  ldap_add: Object class violation (65)
      additional info: invalid structural object class chain (organizationalUnit/referral)
  </code></pre>
  
  <p>I am trying to read up the cause from <a href="http://www.linuxtopia.org/online_books/network_administration_guides/ldap_administration/appendix-common-errors_Common_causes_of_LDAP_errors.html" rel="nofollow">here</a>. However, the cause and solution is a bit unclear to me. Can someone please shed some light on this and suggest remedy?</p>
  
  <p>Thanks in advance!</p>