java.lang.NoClassDefFoundError:javax/servlet/Filter?
我正在将 spring-security 用于桌面应用程序,下面是我的 XML 文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:security="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-2.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd" >
<bean id='myProvider' class='MyAuthenticationProvider'/>
<security:authentication-manager>
<security:authentication-provider ref='MyAuthenticationProvider' />
</security:authentication-manager>
<bean id='authenticationHolder' class='AuthenticationHolder' />
<bean scope="request" factory-bean="authenticationHolder" factory-method="getAuthentication" >
<security:user-service id="userDetailsService">
<security:user name="testUser" password="testPassword" authorities="ROLE_USER"/>
</security:user-service>
</bean>
<bean class="org.springframework.security.authentication.encoding.Md5PasswordEncoder" id="passwordEncoder"/>
<bean id="accessDecisionManager" class="org.springframework.security.vote.AffirmativeBased">
<property name="decisionVoters">
<list>
<bean class="org.springframework.security.vote.RoleVoter">
<property name="rolePrefix" value="MY_PREFIX_" />
</bean>
</list>
</property>
</bean>
<security:global-method-security secured-annotations="enabled"
access-decision-manager-ref="accessDecisionManager" />
运行时我收到此异常
SEVERE: Failed to load required web classes
java.lang.NoClassDefFoundError: javax/servlet/Filter
有帮助吗?谢谢
[编辑] 忘记将 jar 添加到项目中!
I am using spring-security for a desktop application, below is my XML file
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:security="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-2.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd" >
<bean id='myProvider' class='MyAuthenticationProvider'/>
<security:authentication-manager>
<security:authentication-provider ref='MyAuthenticationProvider' />
</security:authentication-manager>
<bean id='authenticationHolder' class='AuthenticationHolder' />
<bean scope="request" factory-bean="authenticationHolder" factory-method="getAuthentication" >
<security:user-service id="userDetailsService">
<security:user name="testUser" password="testPassword" authorities="ROLE_USER"/>
</security:user-service>
</bean>
<bean class="org.springframework.security.authentication.encoding.Md5PasswordEncoder" id="passwordEncoder"/>
<bean id="accessDecisionManager" class="org.springframework.security.vote.AffirmativeBased">
<property name="decisionVoters">
<list>
<bean class="org.springframework.security.vote.RoleVoter">
<property name="rolePrefix" value="MY_PREFIX_" />
</bean>
</list>
</property>
</bean>
<security:global-method-security secured-annotations="enabled"
access-decision-manager-ref="accessDecisionManager" />
When running I am getting this exception
SEVERE: Failed to load required web classes
java.lang.NoClassDefFoundError: javax/servlet/Filter
Any help? thanks
[EDIT]
forgot to add jar to project!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论