码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-11-24 14:31:27      阅读:838      评论:0      收藏:0      [点我收藏+]

标签:undertow   lte   控制台   under   com   lang   roc   put   org   

在编写导出功能使用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异常解决方法

标签:undertow   lte   控制台   under   com   lang   roc   put   org   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!