I am getting this exception when migrating Spring security version 3 to 4. I am implementing it using Sprig 4 XML based security. Your will be really appreciated
Exception:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'util:list#f1d6071': Cannot create inner bean 'security:filter-chain#1c5c0deb' of type [org.springframework.security.web.DefaultSecurityFilterChain] while setting bean property 'sourceList' with key [10]; nested exception is org.springframework.beans.factory.Bea nCreationException: Error creating bean with name 'security:filter-chain#1c5c0deb': Cannot resolve reference to bean 'adminConsoleDeniedExceptionTranslationFilter' while setting co nstructor argument with key [5]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'adminConsoleDeniedExceptionTranslationF ilter' defined in ServletContext resource [/WEB-INF/spring-security.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to a void type ambiguities)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:282) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEASE] at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:121) [spring-beans-4.0.2.RELEASE.jar:4.0.2.RELEAS E]
spring-security.xml (A small portion of impacted Spring 4 XML config)
<bean id="filterChainProxy" class="org.springframework.security.web.FilterChainProxy">
<constructor-arg>
<util:list>
<security:filter-chain pattern="/refreshCache**" filters="scpf,noFilter,logoutFilter"/>
<security:filter-chain pattern="/admin/adminConsole/**" filters="scpf,dsToSpringFilter,securityFilter,logoutFilter,
fsi,adminConsoleDeniedExceptionTranslationFilter,adminConsoleFilter"/>
</util:list>
</constructor-arg>
</bean><bean id="etf"
class="org.springframework.security.web.access.ExceptionTranslationFilter">
<constructor-arg name="authenticationEntryPoint" ref="preAuthenticatedProcessingFilterEntryPoint"/>
</bean><bean id="adminConsoleDeniedExceptionTranslationFilter" class="org.springframework.security.web.access.ExceptionTranslationFilter">
<constructor-arg name="authenticationEntryPoint2" ref="preAuthenticatedProcessingFilterEntryPoint"/>
<constructor-arg ref="adminConsoleAccessDeniedHandler"/></bean><bean id="preAuthenticatedProcessingFilterEntryPoint" class="org.springframework.security.web.authentication.Http403ForbiddenEntryPoint"/><bean id="adminConsoleAccessDeniedHandler" class="org.springframework.security.web.access.AccessDeniedHandlerImpl"><property name="errorPage" value="/WEB-INF/jsp/adminConsoleAccessDenied.jsp"/></bean>
Name attribute in first constructor-arg (of bean adminConsoleDeniedExceptionTranslationFilter
) has weird value authenticationEntryPoint2
:
<bean id="adminConsoleDeniedExceptionTranslationFilter" class="org.springframework.security.web.access.ExceptionTranslationFilter">
<constructor-arg name="authenticationEntryPoint2" ref="preAuthenticatedProcessingFilterEntryPoint"/>
<constructor-arg ref="adminConsoleAccessDeniedHandler"/>
</bean>
It should be authenticationEntryPoint
according documentation.
And else, second constructor-arg has no name
attribute. Consider either to add name
attribute, or remove both.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With