Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 实施Spring Boot安全性时管道破裂_Java_Spring_Spring Mvc_Spring Security_Spring Boot - Fatal编程技术网

Java 实施Spring Boot安全性时管道破裂

Java 实施Spring Boot安全性时管道破裂,java,spring,spring-mvc,spring-security,spring-boot,Java,Spring,Spring Mvc,Spring Security,Spring Boot,我有一个Spring Boot MVC应用程序,运行良好 我试图遵循一些关于集成Spring安全性来处理用户登录的教程,但是,一旦我创建了下面的类,应用程序就会开始生成断管错误 @Configuration public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Excepti

我有一个Spring Boot MVC应用程序,运行良好

我试图遵循一些关于集成Spring安全性来处理用户登录的教程,但是,一旦我创建了下面的类,应用程序就会开始生成断管错误

@Configuration
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .authorizeRequests()
                .antMatchers("/","/home").permitAll()
                .anyRequest().authenticated()
                .and()
                .formLogin()
                .loginPage("/login")
                .permitAll()
                .and()
                .logout()
                .permitAll();
    }

    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
        auth
                .inMemoryAuthentication()
                .withUser("user").password("password").roles("USER");
    }
}
我尝试了许多不同的教程,认为可能原始教程有一些错误,但它仍然在发生

2015-11-25 09:39:57.593  INFO 64614 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization started
2015-11-25 09:39:57.620  INFO 64614 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : FrameworkServlet 'dispatcherServlet': initialization completed in 27 ms
2015-11-25 09:39:58.970 ERROR 64614 --- [nio-8080-exec-2] o.s.boot.context.web.ErrorPageFilter     : Cannot forward to error page for request [/login] as the response has already been committed. As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false

org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe
我不知道是什么原因造成的

我正在本地Tomcat实例上部署此应用程序


为了确认,应用程序似乎仍然正常工作,我不确定这个错误是否需要担心?

我也有同样的错误,但我认为这种错误可能取决于很多事情。我也是,我使用带angularJs堆栈的spring boot

当我试图等待spring boot应用程序的请求(谁需要时间)的答复时,我也遇到了同样的问题

我将我的解决方案放在这里,如果它能帮助某人:

对我来说,问题来自apachehttpd的配置,因为我把我的应用程序放在Apache服务器后面。在我的例子中,apache在超过默认超时(我认为是300秒)时关闭连接。当这种情况发生时,您的spring boot显示
断管
错误

要解决此问题,只需在ApacheHTTPD配置文件的
httpd.conf
中添加
TimeOut yourValueInSecond


在更改配置文件之前,请通过直接在tomcat服务器上发送请求来测试是否确实是由于apache httpd服务器造成的。

我也有同样的错误,但我认为这种错误可能取决于很多因素。我也是,我使用带angularJs堆栈的spring boot

当我试图等待spring boot应用程序的请求(谁需要时间)的答复时,我也遇到了同样的问题

我将我的解决方案放在这里,如果它能帮助某人:

对我来说,问题来自apachehttpd的配置,因为我把我的应用程序放在Apache服务器后面。在我的例子中,apache在超过默认超时(我认为是300秒)时关闭连接。当这种情况发生时,您的spring boot显示
断管
错误

要解决此问题,只需在ApacheHTTPD配置文件的
httpd.conf
中添加
TimeOut yourValueInSecond


在更改配置文件之前,请通过直接在tomcat服务器上发送请求来测试是否确实是由于apache httpd服务器造成的。

多行堆栈跟踪将有所帮助-至少可以看到正在调用的Spring代码。看起来我的代码有问题。我有@RequestMapping(“/”),它正在重定向到另一个方法,并不知何故导致了一个安全性错误。这似乎仍然是一个问题,我已经更新了原始问题,以扩展我得到的错误。我的评论仍然有效。我们需要查看导致异常的代码是从何处调用的,可能是从
WebSecurityConfigurerAdapter
?堆栈跟踪的几行代码将有所帮助-至少可以看到正在调用的Spring代码Edit看起来好像是我的代码出了问题。我有@RequestMapping(“/”),它正在重定向到另一个方法,并不知何故导致了一个安全性错误。这似乎仍然是一个问题,我已经更新了原始问题,以扩展我得到的错误。我的评论仍然有效。我们需要查看导致异常的代码是从哪里调用的,可能是从
WebSecurityConfigurerAdapter