o.s.b.w.servlet.support.ErrorPageFilter : Cannot forward to error page for request ,页面报错404

在这里插入图片描述
部署项目出现的异常:

 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>
  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值