2013-05-20 4 views
0

Active Directory로 LDAP를 설정하려고하는데 오류가 발생하는 경우, 저는 봄 보안이 처음입니다. 나는 어떤 사람의 도움 ....스프링 보안 3.1 LDAP Active Directory 문제

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#13' while setting bean property 'sourceList' with key [13]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#13': Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' while setting constructor argument with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': Cannot resolve reference to bean 'org.springframework.security.authentication.ProviderManager#0' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authentication.ProviderManager#0': Cannot resolve reference to bean 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.authenticationManager': Cannot resolve reference to bean 'myLdapAuthProvider' while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myLdapAuthProvider' defined in ServletContext resource [/WEB-INF/context/webappContext-security.xml]: Resolution of declared constructors on bean Class [org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider] from ClassLoader [WebappClassLoader 
    context: /myApp 
delegate: false 
repositories: 
/WEB-INF/classes/ 
----------> Parent Classloader: 
[email protected] 
] failed; nested exception is java.lang.NoClassDefFoundError:  org/springframework/ldap/NamingException 
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329) 
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) 

내 wepappSecuroty-context.xml에가,

 <?xml version="1.0" encoding="UTF-8"?> 
    <beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:sec="http://www.springframework.org/schema/security" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
    http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd"> 

<sec:http pattern="/public/login.jsp" security="none"/> 
<sec:http pattern="/index.jsp*" security="none"/> 
<sec:http pattern="/images/**" security="none"/> 
<sec:http pattern="/js/**" security="none"/> 
<sec:http pattern="/public/**" security="none"/> 
<sec:http pattern="/styles/**" security="none"/> 
<sec:http pattern="/services/**" security="none"/> 
<sec:http pattern="/public/login.jsp" security="none"/> 


<sec:http use-expressions="true" entry-point-ref="loginUrlAuthenticationEntryPoint"> 
    <sec:intercept-url pattern="/ui/login.do" access="permitAll"/> 
    <sec:intercept-url pattern="/ui/**" access="isAuthenticated()"/> 
    <sec:intercept-url pattern="/**" access="isAuthenticated()"/> 
    <sec:form-login login-page="/public/login.jsp"/> 
</sec:http> 
<bean id="loginUrlAuthenticationEntryPoint" 
     class="org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint"> 
    <property name="loginFormUrl" value="/ui/login.do"/> 
</bean> 
<bean id="securityFilter" 
     class="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter"> 
    <property name="authenticationManager" ref="authenticationManager"/> 
    <!-- When user provides correct username/password and authentication is successful --> 
    <property name="authenticationSuccessHandler" 
       ref="authenticationSuccessHandler"/> 
</bean> 
<sec:authentication-manager alias="authenticationManager"> 
    <sec:authentication-provider ref="myLdapAuthProvider"/> 
</sec:authentication-manager> 
<bean id="myLdapAuthProvider" 
     class="org.springframework.security.ldap.authentication.ad.ActiveDirectoryLdapAuthenticationProvider"> 
    <constructor-arg value="xxxx"/> 
    <constructor-arg value="ldaps://xxxxx:1111/DC=ent,DC=yyy,DC=xxxx,DC=corp"/> 
    <property name="convertSubErrorCodesToExceptions" value="true"/> 
    <property name="useAuthenticationRequestCredentials" value="true"/> 
    <property name="authoritiesMapper" ref="grantedAuthoritiesMapper"/> 
</bean> 

<bean id="grantedAuthoritiesMapper" class="com.blah.security.MyAuthorityMapper"/> 

<bean id="authenticationSuccessHandler" 
     class="org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler"> 
    <property name="defaultTargetUrl" value="/ui/home.do"/> 
</bean> 

답변

1
java.lang.NoClassDefFoundError:  org/springframework/ldap/NamingException 

당신을 가지고 봄 코어 3.2 봄 보안 3.1 수 사용하고 해당 jar (spring-ldap.jar)를 classpath에 추가 했습니까?

그렇다면 spring-ldap.jar의 버전을 spring-core.jar의 버전과 대조하여 확인하십시오.

+0

감사합니다 마지드,이 문제가 해결되었습니다. 나는 다른 오류가 발생했는데, 이것과 관련이 없다. –

+0

훌륭함 (+1). 몇 시간 전에 비슷한 질문에 대답했습니다 : http://stackoverflow.com/questions/16208672/referenced-bean-org-springframework-security-securitycontextsource-not-found/16211899#16211899. 사람들이 정답을 수락하지 않는 경우가 있습니다. ( – Michael

+0

이 질문을 확인해주십시오. http://stackoverflow.com/questions/16697925/spring-security-with-ldap-and-database-roles –