October 26th, 2004, 04:48 PM
-
Adding entries on jndi
Hi all,
i was able to add entires successfully, using an entries.ldif file whith the same dn's slapadd. But I'm trying to add entries using jndi through
after creatting my attributes collection and put it in the ats object i write and connected successfully:
String dn = "cn=fernando,ou=agentes,ou=lab,dc=hospital,dc=imss"
Context res = ctx.createSubContext(dn, ats);
and i get the following exception:
javax.naming.directory.InvalidAttributeIdentifierException: [LDAP: error code 17 - dn: attribute type undefined]; remaining name 'cn=fernando, ou=agentes, ou=lab, dc=hospital, dc=imss'
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3057)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2934)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2740)
at com.sun.jndi.ldap.LdapCtx.c_createSubcontext(LdapCtx.java:777)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_createSubcontext(ComponentDirContext.java:319)
believe me i tried a lot of combinations for the dn:
"dn:cn=fernando,ou=agentes,ou=lab,dc=hospital,dc=imss"
"cn=fernando"
"dc=hospital,dc=imss"
"cn=fernando,dc=hospital,dc=imss"
is there are better examples that can help me out with this one?
Thanks.
November 3rd, 2004, 03:46 AM
-
"dn:cn=fernando,ou=agentes,ou=lab,dc=hospital,dc=imss"
"cn=fernando"
"dc=hospital,dc=imss"
"cn=fernando,dc=hospital,dc=imss"
Use: "dc=hospital,dc=imss,ou=lab,ou=agentes,cn=fernando"
The DN is always starting with the root-dn.
But i think your problem is not the dn;
means, that you're trying to write attributes that aren't allowed in the LDAP schema. Check your code for typing-mistakes..