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的路径与请求路径是否相同