2012-03-14 2 views
1

특수 문자가 포함 된 그룹 이름이 있습니다.Active Directory에 특수 문자가 포함 된 그룹 이름의 그룹 속성 가져 오기

CN=IN&T DC Gebnn/Dohn,OU=ABGroups,OU=Hammers,DC=MyCompany,DC=int 

나는 다음과 같은 코드를 사용하여이 그룹의 속성을 얻기 위해 노력하고 있어요 :

String lstrFullGpName = CN=IN&T DC Gebnn/Dohn,OU=ABGroups,OU=Hammers,DC=MyCompany,DC=int; 
Attributes groupAttributes = actxDir.getAttributes(lstrFullGpName); 

이 다음과 같은 오류가 발생합니다 :

Exception in thread "main" javax.naming.NamingException: [LDAP: error code 1 - 000020D6: SvcErr: DSID-031006CC, problem 5012 (DIR_ERROR), data 0 ]; remaining name ' CN=IN&T DC Gebnn/Dohn,OU=ABGroups,OU=Hammers,DC=MyCompany,DC=int'
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3081)
at com.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_lookup(LdapCtx.java:1011)
at com.sun.jndi.toolkit.ctx.ComponentContext.c_resolveIntermediate_nns(ComponentContext.java:152)
at com.sun.jndi.toolkit.ctx.AtomicContext.c_resolveIntermediate_nns(AtomicContext.java:342)
at com.sun.jndi.toolkit.ctx.ComponentContext.p_resolveIntermediate(ComponentContext.java:381)
at com.sun.jndi.toolkit.ctx.ComponentDirContext.p_getAttributes(ComponentDirContext.java:205)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:121)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:109)
at com.sun.jndi.toolkit.ctx.PartialCompositeDirContext.getAttributes(PartialCompositeDirContext.java:99)
at LDAPApp.main(LDAPApp.java:68)

내가 특수 문자를 탈출 시도를하지만, 그것은 작동하지 않았다. 이 오류가 발생하는 이유는 무엇입니까?

+0

정말 이상한. 다음은 [MSDN siste] (http://msdn.microsoft.com/en-us/library/windows/desktop/ms681390%28v=vs.85%29.aspx)의 내용입니다. ERROR_DS_MISSING_SUPREF 8406 (0x20D6) \t 디렉터리 서비스에 대한 상위 참조가 구성되어 있지 않습니다. 따라서 디렉터리 서비스는이 포리스트 외부의 개체에 대한 조회를 실행할 수 없습니다. –

답변

-1

나는이 문제에 대한 해결책을 마침내 찾을 수있었습니다. 문제는 사용자 이름에 DC가있는 것입니다.

+0

"/"이 (가) 귀하의 문제라고 생각하십니까? 왜, 그리고 그것을 해결하기 위해 DC를 어떻게 피하셨습니까? – RobertG

0

이 공지 JNDI 제한이다

"If the LDAP entry's name contains [a forward slash], then you need to escape it (using the backslash character ('\'))."

http://docs.oracle.com/javase/tutorial/jndi/ldap/jndi.html

즉 자바 문자열 "/" 대신에 문자열 상수에 "\\/"을 사용해야합니다. 이 같은 문자열을 탈출

distinguishedName = distinguishedName.replace("/", "\\/") 
관련 문제