日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

Action請求后臺出現Response already commited異常解決方法

作者:huayang183 更新時間: 2022-03-14 編程語言

在編寫導出功能使用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即可。

原文鏈接:https://blog.csdn.net/qq_18671415/article/details/120915945

欄目分類
最近更新