2010-11-18 20 views
4

私は私のADにいくつかのローカルグループを作成しようとしているが、悲しいことに、私は私のコンテキスト内groupType属性を設定した場合、私はこの例外を受け取るとグループを作成することはJDNI Active Directoryは、スコープ

Caused by: javax.naming.directory.InvalidAttributeValueException: Malformed 'groupType' attribute value; remaining name 'cn=localTestGroup1,ou=groups' 
     at com.sun.jndi.ldap.LdapClient.encodeAttribute(LdapClient.java:951) 
     at com.sun.jndi.ldap.LdapClient.add(LdapClient.java:999) 
     at com.sun.jndi.ldap.LdapCtx.c_bind(LdapCtx.java:393) 
     at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_bind(ComponentDirContext.java:277) 
     at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.bind(PartialCompositeDirContext.java:197) 
     at javax.naming.directory.InitialDirContext.bind(InitialDirContext.java:163) 
     at org.springframework.ldap.core.LdapTemplate$21.executeWithContext(LdapTemplate.java:998) 
     at org.springframework.ldap.core.LdapTemplate.executeWithContext(LdapTemplate.java:807) 
     ... 36 more 

それはその可能です属性の値が間違っています。または私の問題は解決できないのですか? claryficationについては

private void createGroup(String groupname, String groupOU, long groupType) { 
     DistinguishedName dn = new DistinguishedName(); 
     dn.add("ou", groupOU); 
     dn.add("cn", groupname); 

     DirContextAdapter ctx = new DirContextAdapter(dn); 
     ctx.setAttributeValues("objectclass", new String[] { "top", "group" }); 
     ctx.setAttributeValue("groupType", groupType); 
     ctx.setAttributeValue("sAMAccountName", groupname); 

     ldapTemplate.bind(ctx); 
    } 

    public void createLocalGroup(String groupname, String groupOU) { 
     createGroup(groupname, groupOU, -2147483646); 
    } 

:私は、Active Directoryから直接この値-2147483646を得ました。あなたが言及できるように私は使用していますSpring Ldap 1.3

答えて

5

StringとしてgroupTypeの値を渡してみてください。これはあなたの問題を解決するはずです。

しかし、使用しているDNが奇妙に見えます。私の経験上、ADのすべての識別名はDC =何かで終わります。

+0

時にはそれはより簡単に見えます。このために乾杯。 – onigunn