2012-08-15 3 views
0

내가오류 [LDAP를 : 17 오류 코드 - javaSerializedData : 속성 유형 정의]

**public DirContext getLDAPDirContext() throws NamingException { 
    final Hashtable envValues = new Hashtable(); 
    // Assign the JNDI environment values in Map 
    envValues.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); 
    envValues.put(Context.PROVIDER_URL, url); 
    envValues.put(Context.SECURITY_PRINCIPAL,dn); // specify the username 
    envValues.put(Context.SECURITY_CREDENTIALS,password);   // specify the password 
    return new InitialDirContext(envValues); 
} 
public static void main(String arg[]) throws NamingException { 
    LdapNew ldapNew = new LdapNew(); 
    String groupDN ="ou=user,dc=ldap,dc=***,dc=***"; 
    BasicAttributes myAttrs = new BasicAttributes(true); //Basic Attributes 
    myAttrs.put("uid","chamils"); 
    myAttrs.put("objectClass","top"); 
    myAttrs.put("objectClass","dcObject"); 
    myAttrs.put("objectClass","organization"); 
    myAttrs.put("objectClass", "inetOrgPerson"); 
    myAttrs.put("cn","FNAME LNAME"); 
    myAttrs.put("displayname", "FNAME LNAMEE"); 
    myAttrs.put("givenname","Chamilseeee"); 
    myAttrs.put("sn","Thanthrimudaliged"); 
    myAttrs.put("mail","*******"); 
    DirContext ctx = ldapNew.getLDAPDirContext(); 
    ctx.bind("uid=chamils,ou=user,dc=ldap,dc=****,dc=***",myAttrs); 
}** 

를 LDAP에 사용자를 추가하려면이 코드 조각을 사용하지만

예외에 제공 thread "main" javax.naming.directory.InvalidAttributeIdentifierException : [LDAP : 오류 코드 17 - javaSerializedData : 속성 유형이 정의되지 않음]; 나머지 이름 COM에서 com.sun.jndi.ldap.LdapCtx.mapErrorCode (LdapCtx.java:3110)에서 'UID = chamils, OU = 사용자, DC = LDAP, DC = , DC ='. sun.jndi.ldap.LdapCtx.processReturnCode (LdapCtx.java:2987) at com.sun.jndi.ldap.LdapCtx.processReturnCode (LdapCtx.java:2794) at com.sun.jndi.ldap.LdapCtx.c_bind (LdapCtx.java:397) at com.sun.jndi.ldap.LdapCtx.c_bind (LdapCtx.java:354) at com.sun.jndi.toolkit.ctx.ComponentContext.p_bind (ComponentContext.java:596) at com.sun.jndi.toolkit.ctx.PartialCompositeContext.bind (PartialCompositeContext.java:183) at com.sun.jndi.toolkit.ctx.ArtialContext.bind java.lang의에서 sun.reflect.NativeMethodAccessorImpl.invoke0 sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)에서 sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)에서 (기본 방법) .reflect.Method.invoke com.intellij.rt.execution.application.AppMain.main (AppMain.java:120)에서 (Method.java:597는)

왜이다.

답변

1

OpenLDAP 구성에 include schema/java.schema을 추가해야합니다.