• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

First node in LDAP and JNDI problem

Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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");
// add attclasses to to the attrib set
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
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ht.put(Context.SECURITY_PRINCIPAL, "cn=Directory Manager,dc=x,dc=com");
ht.put(Context.SECURITY_PRINCIPAL, "cn=Directory Manager");
I assume, you realize that the second statement will replacethe first statement.
and POOF! You're gone! But look, this tiny ad is still here:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic