ich die Gruppe Distinguished Name zu ändern versuche mit Hilfe von Java-Paket Naming aber jedes Mal bekomme ich die gleiche FehlermeldungÄndern Distinguished Name mit Java Naming
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
env.put(Context.PROVIDER_URL, url);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, user);
env.put(Context.SECURITY_CREDENTIALS, password);
env.put(Context.REFERRAL, "follow");
DirContext ctx = new InitialDirContext(env);
ModificationItem[] roleMods = new ModificationItem[]
{
new ModificationItem(DirContext.REPLACE_ATTRIBUTE, new BasicAttribute("distinguishedName",DN2))
};
ctx.modifyAttributes(DN1,roleMods);
Und jedes Mal, wenn ich diesen Fehler:
Exception in thread "main" javax.naming.directory.InvalidAttributeValueException: [LDAP: Fehlercode 19 - 000020B1: AtrErr: DSID-030F04A3, # 1: 0: 000020B1: DSID-030F04A3, problem 1005 (CONSTRAINT_ATT_TYPE), Daten 0, Att 31 (distinguishedName)
Ist es überhaupt möglich, DN zu ändern, wenn ja, wie soll ich es tun?
Vielen Dank für Ihre Hilfe Ich glaube nicht, dass die Umbenennung auch funktionieren würde. Ich versuche dies ctx.rename ("distinguishedName = '" + DN1 + "'", "distinguishedName = '" + DN2 + "'"); Aber immer noch bekomme ich den gleichen Fehler. – Rome
Können Sie genauer sein und die Werte angeben? –
Das offizielle JNDI-Lernprogramm hilft möglicherweise auch http://docs.oracle.com/javase/jndi/tutorial/basics/naming/rename.html ctx.rename (DN1, DN2) –