[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
(ITS#4470) how to use JNDI to extend schema
Full_Name: cuimeng
Version: openldap 2.2.19
OS: windows xp home edition
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (221.222.14.218)
when I use JNDI to add an attribute to openldap schema, I get a problem,
following is my program.
import javax.naming.directory.*;
import javax.naming.*;
import java.util.Hashtable;
public class add {
public add() {
}
public static void main(String[] args) {
String password = "cm";
String basedn = "dc=cm,dc=com";
DirContext ctx = null;
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
/
env.put(Context.PROVIDER_URL, "ldap://localhost:389/"+basedn );
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, "cn=root,"+basedn );
env.put(Context.SECURITY_CREDENTIALS, password);
try {
ctx = new InitialDirContext(env);
System.out.println("connect ok");
}
catch (Exception e) {
System.out.println(e.toString());
}
try{
DirContext schemaCtx = ctx.getSchema("");
BasicAttributes attrs = new BasicAttributes(true);
attrs.put("NAME", "test");
attrs.put("NUMERICOID", "1.3.6.1.4.1.7914.1.2.1.16");
attrs.put("SYNTAX", "1.3.6.1.4.1.1466.115.121.1.15");
attrs.put("SINGLE-VALUE", "TRUE");
schemaCtx.createSubcontext("AttributeDefinition/test", attrs);
System.out.println("ok");
}catch(Exception e){
System.out.println("Exception in add():"+e);
}
}
}
I get the exception
Exception in add():javax.naming.OperationNotSupportedException: [LDAP: error
code 53 - modification of subschema subentry not supported]; remaining name ''
on trying to add an attribute.
All help is welcome,
Thank you
?@?@?@?@?@?@?@?@?@?@?@?@?@?@cm?@?@?@?@?@?@?@?@?@?@?@
?@?@?@?@?@