關於spring security的錯誤


信息: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory @8ddb93 : defining beans [org.springframework.security.filterChains,org.springframework.security.filterChainProxy,org.springframework.security.web.DefaultSecurityFilterChain# 0 ,org.springframework.security.web.PortMapperImpl# 0 ,org.springframework.security.web.PortResolverImpl# 0 ,org.springframework.security.config.authentication.AuthenticationManagerFactoryBean# 0 ,org.springframework.security.authentication.ProviderManager# 0 ,org.springframework.security.web.context.HttpSessionSecurityContextRepository# 0 ,org.springframework.security.core.session.SessionRegistryImpl# 0 ,org.springframework.security.web.authentication.session.ConcurrentSessionControlStrategy# 0 ,org.springframework.security.web.savedrequest.HttpSessionRequestCache# 0 ,org.springframework.security.access.vote.AffirmativeBased# 0 ,org.springframework.security.web.access.intercept.FilterSecurityInterceptor# 0 ,org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator# 0 ,org.springframework.security.authentication.AnonymousAuthenticationProvider# 0 ,org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter# 0 ,org.springframework.security.userDetailsServiceFactory,org.springframework.security.web.DefaultSecurityFilterChain# 1 ,org.springframework.security.provisioning.InMemoryUserDetailsManager# 0 ,org.springframework.security.authentication.dao.DaoAuthenticationProvider# 0 ,org.springframework.security.authentication.DefaultAuthenticationEventPublisher# 0 ,org.springframework.security.authenticationManager]; root of factory hierarchy
2013 - 10 - 4  10 : 07 : 16  org.springframework.web.context.ContextLoader initWebApplicationContext
嚴重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name  'org.springframework.security.filterChains' : Cannot resolve reference to bean  'org.springframework.security.web.DefaultSecurityFilterChain#1'  while  setting bean property  'sourceList'  with key [ 1 ]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name  'org.springframework.security.web.DefaultSecurityFilterChain#1' : Cannot resolve reference to bean  'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0'  while  setting constructor argument with key [ 2 ]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name  'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' : Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/authentication/InternalAuthenticationServiceException
   
 
類似這樣的錯誤大致是配置文件的問題
1.可以考慮從pom的Maven依賴入手,因為spring-security的依賴對spring的依賴要求較為嚴格
2.可以考慮從web.xml文件的配置想想辦法,是否引入注解的spring-*xml....等等
3.

<security:authentication-manager>
<security:authentication-provider user-service-ref="userService">
<!-- 配置加密的方式 -->
<!-- <security:password-encoder ref="passwordEncoder"/> -->
</security:authentication-provider>
</security:authentication-manager>

存不存在userService相同的Service注解導致無法找到注解

希望能幫到你。有更好的想法可以討論


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM