cano63
asked on
Ldap modify attribute with com.sun.jndi.ldap.LdapCtxFactory
Hello ,
I,m trying to update a attribute vale in my ldap, i,m using com.sun.jndi.ldap.LdapCtxF actory class..
I,m able to get the users information but not update them,
I receive the following error
java.lang.NullPointerExcep tion
at com.sun.jndi.ldap.LdapCtx. c_modifyAt tributes(L dapCtx.jav a:1445)
at com.sun.jndi.toolkit.ctx.C omponentDi rContext.p _modifyAtt ributes(Co mponentDir Context.ja va:267)
at com.sun.jndi.toolkit.ctx.P artialComp ositeDirCo ntext.modi fyAttribut es(Partial CompositeD irContext. java:184)
at com.sun.jndi.toolkit.ctx.P artialComp ositeDirCo ntext.modi fyAttribut es(Partial CompositeD irContext. java:173)
at javax.naming.directory.Ini tialDirCon text.modif yAttribute s(Unknown Source)
at UpdateAttributes.main(Upda teAttribut es.java:86 )
I,m trying to update a attribute vale in my ldap, i,m using com.sun.jndi.ldap.LdapCtxF
I,m able to get the users information but not update them,
I receive the following error
java.lang.NullPointerExcep
at com.sun.jndi.ldap.LdapCtx.
at com.sun.jndi.toolkit.ctx.C
at com.sun.jndi.toolkit.ctx.P
at com.sun.jndi.toolkit.ctx.P
at javax.naming.directory.Ini
at UpdateAttributes.main(Upda
DirContext ctx = new InitialDirContext(env);
String name = "uid=myID,cn=df,ou=customer,o=company";
// Specify the changes to make
ModificationItem[] mods = new ModificationItem[3];
// Replace the "mail" attribute with a new value
mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("type", "UUUU"));
// Perform the requested modifications on the named object
ctx.modifyAttributes(name, mods);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER