java.lang.IllegalStateException: Cannot call sendError() after the response has been committe


1、問題描述

嚴重: Servlet.service() for servlet [default] in contextwith path [/OxygenCloud] threw exception

java.lang.IllegalStateException:Cannot call sendError() after the response has been committed

 

 

 

2、問題分析

從提示錯誤的字面意思判斷“Cannotcall sendError() after the response has been committed”,“當response被提交后不能調用sendError()”。

出現這個錯誤,應該是多次response導致的,可以這么理解,http server發送response后就關閉了socket,這個時候再次發送response給http client就會出現這個問題。

例子:

 

 

 

 

 

 

3、問題解決

查看我的代碼里面的情況:

 

 重啟運行,這個問題就沒有了。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM