org.apache.catalina.connector.ClientAbortException: java.io.EOFException: Unexpected EOF read on the
阿新 • • 發佈:2021-01-16
技術標籤:vue-cli3
今天遇到個這樣的問題,我的專案是前後端分離的,在前端是基於VUE-ADMIN腳手架做的,後端是一個標準的springboot工程,然後自己封裝了一次http單獨使用,並且在vue.config.js中配置了代理,但是一直請求不到後臺伺服器,伺服器一直報異常資訊如下
2021-01-14 11:16:44.143 WARN 22252 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: I/O error while reading input message; nested exception is org.apache.catalina.connector.ClientAbortException: java.io.EOFException: Unexpected EOF read on the socket] 2021-01-14 11:18:43.592 WARN 22252 --- [nio-8080-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: I/O error while reading input message; nested exception is org.apache.catalina.connector.ClientAbortException: java.io.EOFException: Unexpected EOF read on the socket] 2021-01-14 11:18:52.449 WARN 22252 --- [nio-8080-exec-3] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.converter.HttpMessageNotReadableException: I/O error while reading input message; nested exception is org.apache.catalina.connector.ClientAbortException: java.io.EOFException: Unexpected EOF read on the socket]
用postman直接請求介面是可以成功的,很奇怪,請求頭都設定好了的,通過分析發現,是由於請求再發生時,請求體body已經沒了,按照VUE-ADMIN腳手架的設計,只會是由於moke引起的,進入moke-server.js中發現,果然如此
註釋掉上面四行程式碼就可以正常想伺服器傳送請求了!