Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JNDI Error in creating entries in LDAP's Active Directory.  RSS feed

 
Jesu Mani
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trying to create a new entry in ldap's active directory of a windows 2000 server:

Guide me on this error:

Create failed: javax.naming.NoPermissionException: [LDAP: error code 50 - Insufficient 'add' privilege to add the entry 'ou=Fruits,o=NetscapeRoot'.
]; remaining name 'ou=Fruits'

The code executed:
class Create {
public static void main(String[] args) {

// Set up the environment for creating the initial context
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://csindia.com:12805/o=NetscapeRoot");


try {
// Create the initial context
DirContext ctx = new InitialDirContext(env);

// Create attributes to be associated with the new context
Attributes attrs = new BasicAttributes(true); // case-ignore
Attribute objclass = new BasicAttribute("objectclass");
objclass.add("top");
objclass.add("organizationalUnit");
attrs.put(objclass);

// Create the context
Context result = ctx.createSubcontext("ou=Fruits", attrs);

// Check that it was created by listing its parent
NamingEnumeration list = ctx.list("");

// Go through each item in list
while (list.hasMore()) {
NameClassPair nc = (NameClassPair)list.next();
System.out.println(nc);
}

// Close the contexts when we're done
result.close();
ctx.close();
} catch (NamingException e) {
System.out.println("Create failed: " + e);
}
}
}

Thanks.
Jesu Mani
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!