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 的路径与请求路径是否相同
来源: http://www.bubuko.com/infodetail-3351421.html