1.情況 :
服務已經注冊到eureka,eureka中可以看到,但是 consumer和provider這兩個服務,一直報錯,
錯誤信息:DiscoveryClient_CONSUMER-DEMO/XXXX:consumer-demo:8080 - was unable to refresh its cache! status = Cannot execute request on any known server
解決方法:檢查eureka配置文件中下面這段配置
eureka:
client:
service-url:
defaultZone: http://localhost:10086/eureka
這段代碼,建議重寫,或者從別的項目中復制一份過來
2.情況:
錯誤信息:Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Requestprocessingfailed;nestedexceptionisorg.springframework.web.client.HttpClientErrorException$NotFound: 404 null] with root cause
從中我們可以看到,404請求路徑中出現問題,
解決方法:進入dubug,檢查controller調用servcie的路徑與請求路徑是否相同