2011-03-22 7 views
0

다음 문제가 있습니다. 아래에 표시된대로 InitialContext에 대한 LDAP 설정 JNDI 환경 등록 정보에서 컨텍스트를 얻습니다. 그런 다음 LDAP 서버를 다시 시작하고 InitialContext를 다시 가져 오려고 할 때마다 다음 예외가 throw됩니다.예외 - ldap 서버가 재시작 된 후 LDAP 액세스 ldap 서버

컨텍스트를 가져 오는 코드.

Context ctx = null; 

    Hashtable ht = new Hashtable(); 
    ht.put(Context.INITIAL_CONTEXT_FACTORY, 
     "weblogic.jndi.WLInitialContextFactory"); 
    ht.put(Context.PROVIDER_URL,"t3://localhost:7001"); 
    ht.put(Context.SECURITY_PRINCIPAL,"USER1"); 
    ht.put(Context.CREDENTIALS,"PASSWORD1"); 
    try { 
    ctx = new InitialContext(ht); 
    } 
    catch (NamingException e) { 
    } 
    finally { 
    try {ctx.close(); 
    } 
    catch (Exception e) { 
     // a failure occurred 
    } 
    } 

예외 : 당신은 인증에 적절한 DN을 제공하지 않는

java.security.PrivilegedActionException: javax.naming.ConfigurationException: Call to NamingManager.getObjectInstance() failed: 
[Root exception is java.lang.SecurityException: 
[Security:090398]Invalid Subject: principals=[ADMIN]]; remaining name '' 
BEA-090398 

답변

1

:

ht.put(Context.SECURITY_PRINCIPAL,"USER1");

당신은 cn = USER1, OU = 뭔가, DC = 뭔가를해야한다 , dc = com 등.