• 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 ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

How to add a user in the Active Directory via JNDI/LDAP?  RSS feed

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI all,
I am puzzled how to add a user in AD,please show your hands?
Server : Win2k Advanced Server,Active Directory,Exchange Server 2000
Client : jdk1.4
I access AD via JNDI/LDAP to add an entry,and the codes as below
public void addUser(){
/* Specify the DN we're adding */
String dn = "CN=test1,CN=Users,DC=acdemo,DC=com";
Attribute cn = new BasicAttribute("cn", "test1");
Attribute objClasses = new BasicAttribute("objectClass");
Attribute instanceType = new BasicAttribute("instanceType", "4");
Attribute objectCategory = new BasicAttribute("objectCategory", "CN=Person,CN=Schema,CN=Configuration,DC=acdemo,DC=com");
Attributes orig = new BasicAttributes(true);
Hashtable env = new Hashtable(5, 0.75f);
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, "ldap://");
/* specify authentication information */
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "CN=Administrator,CN=Users,DC=acdemo,DC=com");
env.put(Context.SECURITY_CREDENTIALS, "pass");//password
DirContext ctx = null;
try {
ctx = new InitialDirContext(env);
/* Add the entry */
ctx.createSubcontext(dn, orig);
catch (NamingException e) {
when I run,it throws the exception as below:
javax.naming.OperationNotSupportedException: [LDAP: error code 53 - 0000209A: SvcErr: DSID-031A0929, problem 5003 (WILL_NOT_PERFORM), data 0
Anybody can help me?
I got points from SUN's forum that I should make a SSL connection between C/S,but may you show me a step-by-step guides?
Thanks in advance
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the Security forum.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!