Hi, in my code
....
Hashtable ht = new Hashtable();
ht.put(Context.SECURITY_PRINCIPAL, "cn=Directory Manager,dc=x,dc=com");
ht.put(Context.SECURITY_PRINCIPAL, "cn=Directory Manager");
ht.put(Context.SECURITY_CREDENTIALS, "password");
ht.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
ht.put(Context.PROVIDER_URL, "ldap://localhost:389");
InitialDirContext initcntx = new InitialDirContext(ht);
// get the namespace
String namespace = initcntx.getNameInNamespace();
BasicAttributes attrs = new BasicAttributes();
// the new is sub-class of the person witch is subclass of top. Store the hierarchy in objectclass attb
Attribute classes = new BasicAttribute("objectclass");
classes.add("top");
classes.add("person");
classes.add("organizationalperson");
// add attclasses to to the attrib set
attrs.put(classes);
String shost = "ldap://localhost/cn=Ricardo Baraldi," + "o=x,dc=xp,dc=com";
//add the new entry to direct server
initcntx.createSubcontext(shost, attrs);
I always got an NamingException. The tree is empty because is the first node. How can i create the firts time node (root)?
Best Regards
Ricardo