I am trying to create sub context for domain component, but its showing the following error
javax.naming.OperationNotSupportedException: [LDAP: error code 53 - no global superior knowledge]; remaining name 'uid=user3, dc=example'
This is my Code
public class OpenLDAPTest {
public static void main(String[] args) {
String url = "ldap://localhost:389";
// String url = "ldap://localhost:10389";
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, url);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "cn=Manager,dc=maxcrc,dc=com");
// env.put(Context.SECURITY_PRINCIPAL, "uid=admin, ou=system");
env.put(Context.SECURITY_CREDENTIALS, "secret");
try {
DirContext ctx = new InitialDirContext(env);
System.out.println("connected");
System.out.println(ctx.getEnvironment());
System.out.println("Creating subContext");
String name = "uid=user3, dc=example";
Attributes atrs = new BasicAttributes();
Attribute atr1 = new BasicAttribute("objectClass");
atr1.add("inetOrgPerson");
atrs.put(atr1);
Attribute atr2 = new BasicAttribute("cn");
atr2.add("sathish");
atrs.put(atr2);
Attribute atr3 = new BasicAttribute("o");
atr3.add("Kumar");
atrs.put(atr3);
Attribute atr4 = new BasicAttribute("sn");
atr4.add("example");
atrs.put(atr4);
Context c = ctx.createSubcontext(name, atrs);
System.out.println(c.getEnvironment());
ctx.close();
} catch (AuthenticationNotSupportedException ex) {
System.out
.println("The authentication is not supported by the server");
} catch (AuthenticationException ex) {
System.out.println("incorrect password or username");
} catch (NamingException ex) {
// System.out.println("error when trying to create the context");
ex.printStackTrace();
}
}
}
If I use the same code for ApacheDS(by changing credentials) its working. but its not working for openLDAP.

slapd.exeitself. You should create an administrative account inside the DIT that has the appopriate privileges. - user207421