在使用Spring Cloud的時候碰見了 這個異常:java
feign.RetryableException: Read timed out executing POST xxxxxx at feign.FeignException.errorExecuting(FeignException.java:65) at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:105) at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:77) at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:102) at com.sun.proxy.$Proxy113.generateUserContract(Unknown Source) ..... Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.net.SocketInputStream.read(SocketInputStream.java:171) at java.net.SocketInputStream.read(SocketInputStream.java:141) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read1(BufferedInputStream.java:286) at java.io.BufferedInputStream.read(BufferedInputStream.java:345) at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:735) at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:678) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1587) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at feign.Client$Default.convertResponse(Client.java:150) at feign.Client$Default.execute(Client.java:72)
spring boot :2.0.6.RELEASEspring
spring cloud :Finchley.SR2socket
組件中使用了 Eureka 、Feign ,由於Feign中引用了Ribbon,因此就沒有顯示引用jar..net
再往上找到了各類碰見這個問題的解決方案,可是在這個版本號以內已經沒有了:code
ribbon.connect-timeout和ribbon.read-timeout 這兩個變量的定義,因此在看了官方文檔以後:文檔
feign.client.config.default.connect-timeout=20000 feign.client.config.default.read-timeout=20000
這兩個參數就能夠解決timeout的問題。get