简体   繁体   English

Spring Security 4无法在Tomcat 7上创建bean FilterChain

[英]Spring Security 4 Cannot create bean FilterChain on Tomcat 7

A project which I downloaded from a repository fails to run on Apache Tomcat 7. It is a Spring 4.1.6 application with Spring security 4.0.1 and OpenAM version 10.0.0. 我从存储库下载的项目无法在Apache Tomcat 7上运行。这是具有Spring安全性4.0.1和OpenAM版本10.0.0的Spring 4.1.6应用程序。 The run process fails on my local Apache Tomcat 7 instance with an error stating 运行过程在本地Apache Tomcat 7实例上失败,并显示错误消息

SEVERE: 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.security.filterChains':
...

The nested exception is 嵌套的异常是

org.springframework.beans.BeanInstantiationException: Could not instantiate bean class
[org.springframework.security.web.authentication.session.ChangeSessionIdAuthenticationStrategy]: Constructor threw exception;
nested exception is java.lang.IllegalStateException: HttpServletRequest.changeSessionId is undefined. Are you using a Servlet 3.1+ environment?

The pom.xml file is set up with pom.xml文件设置为

<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>

<filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

I know this is a build environment configuration issue because the source code has been run successfully on another machine. 我知道这是一个构建环境配置问题,因为源代码已在另一台计算机上成功运行。 What needs to change to get the filterChains bean to be created successfully 要成功创建filterChains bean需要进行哪些更改

The key thing to note in the log was the: 日志中要注意的关键是:

HttpServletRequest.changeSessionId is undefined. HttpServletRequest.changeSessionId未定义。 Are you using a Servlet 3.1+ environment? 您正在使用Servlet 3.1+环境吗?

By upgrading to Tomcat 8 and using Java EE 7 Web, I was able to get the project to run successfully. 通过升级到Tomcat 8并使用Java EE 7 Web,我能够使项目成功运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring 安全性 - 过滤器链错误 - 在 class 路径资源中定义名称为“filterChain”的 bean 创建错误 - Spring Security - Filter Chain Error - Error creating bean with name 'filterChain' defined in class path resource Spring FilterChain + Security:用户是否记录日志请求 - Spring FilterChain + Security: log request with user or not Spring无法创建bean - Spring cannot create bean 在Spring Security过滤链中添加嵌套的自定义过滤器 - Add nested custom filters in Spring Security filterchain 有条件地通过 spring 安全过滤器链 - Conditionally passing through spring security filterchain Spring Security .DaoAuthenticationProvider:无法解析对bean的引用 - Spring Security .DaoAuthenticationProvider: Cannot resolve reference to bean 创建无法自动连线的Spring bean - Create a Spring bean that cannot be autowired Spring 无法创建 UserService bean - Spring cannot create UserService bean 具有弹簧安全性的Oauth2:创建名称为&#39;oauth2TokenGranter&#39;的bean时出错:无法创建类型为ResourceOwnerPasswordTokenGranter的内部bean - Oauth2 with Spring-Security: Error creating bean with name 'oauth2TokenGranter': Cannot create inner bean of type ResourceOwnerPasswordTokenGranter Spring和Spring安全配置帮助,找不到bean - Spring and Spring security configuration help, cannot find a bean
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM