部署项目出现的异常:
o.s.b.w.servlet.support.ErrorPageFilter : Cannot forward to error page for request [/login/page] 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
这段异常翻译过来是这个:
o、 s.b.w.servlet.support.ErrorPageFilter:无法转发到请求的错误页[/login/page],因为响应已提交。因此,响应可能具有错误的状态代码。如果您的应用程序正在WebSphere application Server上运行,则可以通过将com.ibm.ws.webcontainer.invokeFlushAfterService设置为false来解决此问题
我用的是springboot框架,maven打包,命令行打包也是这样,原因是我在pom.xml配置了下图代码:
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
这里的resources会把springboot结构中的resources给覆盖掉,打包时只打包pom文件指定的java文件,不会将resources中的页面和配置文件打包,所以会出现这种异常
解决方法:如果不需要这段代码,就删掉;如果需要,可以使用下面的方式,将resources中的文件也打包进去
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>