首页 > 其他 > 详细

Action请求后台出现Response already commited异常解决方法

时间:2018-11-24 13:50:04      阅读:544      评论:0      收藏:0      [点我收藏+]

在编写导出功能使用action请求,在处理导出异常时期望跳转异常页,Controller中的方法返回类型String的url

技术分享图片

在处理完逻辑导出文件后后台控制台出现

WARN  [org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver] (default task-22) Handling of [org.springframework.http.converter.HttpMessageNotWritableException] resulted in Exception: java.lang.IllegalStateException: UT010019: Response already commited

and

ERROR [io.undertow.request] (default task-22) UT005023: Exception handling request to /snq-admin/data/exportDataDetail.do: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: UT010029: Stream is closed; nested exception is java.io.IOException: UT010029: Stream is closed

Caused by: org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: UT010029: Stream is closed; nested exception is java.io.IOException: UT010029: Stream is closed

Caused by: java.io.IOException: UT010029: Stream is closed

在写入文件时调用requestOutputStream.write()方法已将response发出,再在Controller中return时被认为是再发送一次,因而会报错,解决这个问题只需返回null即可。

技术分享图片

 

Action请求后台出现Response already commited异常解决方法

原文:https://www.cnblogs.com/seedling/p/10011551.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!