Igor Styrman

Greenhorn
+ Follow
since May 15, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Igor Styrman

Hi,
Running following code to rename entries:
******************************************************************************
Hashtable hashtableEnvironment = new Hashtable();
hashtableEnvironment.put(
Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory"
);
hashtableEnvironment.put(
Context.PROVIDER_URL, "ldap://ip ort"
);
Hashtable env;
//read parameters from properties file
readParameters();
env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,initialContextFactoryLDAP);
env.put(Context.PROVIDER_URL,providerUrlLDAP);
env.put(Context.SECURITY_PRINCIPAL,securityPrincipalLDAP);
env.put(Context.SECURITY_CREDENTIALS,securityCredentialsLDAP);
env.put("java.naming.ldap.version","3");
DirContext dirContext = new InitialDirContext(env);
String DNa = "o=testiPT, o=testiPT, o=testiRP, o=Juuri, l=Ammattilaiset, c=fi";
String DNb = "ou=testiPT, o=testiPT, o=testiRP, o=Juuri, l=Ammattilaiset, c=fi";
dirContext.rename(DNa, DNb);
dirContext.close();
******************************************************************************
Exception follows:
javax.naming.InvalidNameException: o=testiPT, o=testiPT, o=testiRP, o=Juuri, l=A
mmattilaiset, c=fi: [LDAP: error code 64 - Update Error: Naming Violation]; rema
ining name 'o=testiPT, o=testiPT, o=testiRP, o=Juuri, l=Ammattilaiset, c=fi'
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(Unknown Source)
at com.sun.jndi.ldap.LdapCtx.c_rename(Unknown Source)
at com.sun.jndi.toolkit.ctx.ComponentContext.p_rename(Unknown Source)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.rename(Unknown Sourc
e)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.rename(Unknown Sourc
e)
at javax.naming.InitialContext.rename(Unknown Source)
at LDAP.main(LDAP.java:64)
******************************************************************************
Renaming just the leaf name works fine, but changeing any node-type (= o --> ou) gives problems. Renaming middle-node also causes exception.
The LDAP server is providing both versions 2 and 3 simultaneusly. The admin tells me its ok and that there should be no problem with the server maybe being restricted to v2... Anyone had similar case? Any ideas would be appreciated.
Actually I can make this type of renaming work by binding the target and its sub-nodes to a new node of the same level, and then deleting the original.. But id be intrested to know if it ought to be possible to do this with the standard API?
Thanks,
Igor
21 years ago