首页 / JAVA / java.lang.NoClassDefFoundError:org / springframework / security / authentication / AuthenticationMan
java.lang.NoClassDefFoundError:org / springframework / security / authentication / AuthenticationMan
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了java.lang.NoClassDefFoundError:org / springframework / security / authentication / AuthenticationMan,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含5550字,纯文字阅读大概需要8分钟。
内容图文
我试图通过引用以下链接在Spring Web服务上实现身份验证:
http://docs.spring.io/spring-ws/site/reference/html/security.html
以下是我添加的配置:
<bean
class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
<property name="interceptors">
<list>
<ref local="wsServerSecurityInterceptor" />
<ref local="payloadValidatingIterceptor" />
</list>
</property>
</bean>
<bean id="wsServerSecurityInterceptor"
class="org.springframework.ws.soap.security.xwss.XwsSecurityInterceptor">
<property name="policyConfiguration"
value="classpath:security/xwss/security-server-policy.xml" />
<property name="callbackHandlers">
<list>
<!-- <ref bean="keyStoreHandlerServer" /> -->
<ref bean="springSecurityHandler" />
<ref bean="callbackHandlerServer" />
</list>
</property>
</bean>
<bean id="springSecurityHandler"
class="org.springframework.ws.soap.security.xwss.callback.SpringPlainTextPasswordValidationCallbackHandler">
<property name="authenticationManager" ref="authenticationManager"/>
</bean>
<bean id="authenticationManager" class="org.springframework.security.providers.ProviderManager">
<property name="providers">
<list>
<ref local="authenticationProvider" />
</list>
</property>
</bean>
<bean id="authenticationProvider"
class="org.springframework.security.providers.dao.DaoAuthenticationProvider">
<property name="userDetailsService" ref="userDetailsService"/>
</bean>
<bean id="userDetailsService" class="com.impl.endpoints.calc.client.JpaUserDetailsService" />
在服务器上部署war文件时,出现以下错误:
Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping#0' defined in ServletContext resource [/WEB-INF/xws-spring-ws-servlet.xml]: Cannot resolve reference to bean 'wsServerSecurityInterceptor' while setting bean property 'interceptors' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wsServerSecurityInterceptor' defined in ServletContext resource [/WEB-INF/xws-spring-ws-servlet.xml]: Cannot resolve reference to bean 'springSecurityHandler' while setting bean property 'callbackHandlers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityHandler' defined in ServletContext resource [/WEB-INF/xws-spring-ws-servlet.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/authentication/AuthenticationManager
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:154)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1387)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1128)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
在配置或代码中的任何地方都没有提到org / springframework / security / authentication / AuthenticationManager.我想知道给定类的确切位置以及我需要做什么配置更改来解决此错误.
编辑:
POM包含以下弹簧安全罐:
<dependency>
<groupId>
org.springframework.security
</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>2.0.4</version>
</dependency>
<dependency>
<groupId>
org.springframework.security
</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>3.1.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
<version>3.1.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId>
<version>2.2.0.RELEASE</version>
<exclusions>
<exclusion>
<groupId>com.sun.xml.wsit</groupId>
<artifactId>xws-security</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.xml.wsit</groupId>
<artifactId>wsit-rt</artifactId>
</exclusion>
</exclusions>
</dependency>
解决方法:
您正在配置中混合使用Spring Security 2和Spring Security 3.对所有Spring Security jar使用相同(和最新)的版本号.你有spring-security-core jar版本2.0.4和其他版本3.1.7.RELEASE版本.对所有jar使用当前发行版本,并确保在构建项目时WEB-INF / lib中没有不同的版本.
包名称也在2到3之间更改.如果您需要知道类所在的包,请使用API docs.
内容总结
以上是互联网集市为您收集整理的java.lang.NoClassDefFoundError:org / springframework / security / authentication / AuthenticationMan全部内容,希望文章能够帮你解决java.lang.NoClassDefFoundError:org / springframework / security / authentication / AuthenticationMan所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。