[ Spring Boot ] o.s.boot.web.support.ErrorPageFilter

错误
2017-01-06 18:28:23.933 ERROR 80102 --- [nio-8088-exec-6] 
o.s.boot.web.support.ErrorPageFilter     : Cannot forward to error page for 
request [/strategy/list/] 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

遇到这个错误纠结了很久.. 显示设置了com.ibm.ws.webcontainer.invokeFlushAfterServicefalse, 方式如下

public MainApplication(){    
      super();   
    setRegisterErrorPageFilter(false);
}

或者

@Bean    
 public ErrorPageFilter errorPageFilter() {   
      return new ErrorPageFilter();   
 }    
@Bean
public FilterRegistrationBean disableSpringBootErrorFilter(ErrorPageFilter filter) {        
      FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();           
      filterRegistrationBean.setFilter(filter);      
      filterRegistrationBean.setEnabled(false);      
      return filterRegistrationBean;  
}

这样的错误,好比当年用 servlet 的时候,说什么 response 已经使用,而再次使用,或者路径已经转发,你却在转发之后用 response 等等这样的问题,,在 springboot 中,我也以为是这样的问题,其实答案很简单 就是找不到这个 url!!!! 路径写错了而已


作者:蒙奇D鲁班
链接:https://www.jianshu.com/p/d5b09aa5d082
來源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

上一篇:Android Studio DrawerLayout控件在v4包中找不到


下一篇:《python数据分析与挖掘实战》第八章详解