【发布时间】:2016-11-13 15:13:38
【问题描述】:
据此博客https://spring.io/blog/2015/07/14/microservices-with-spring
能够毫无问题地运行该应用程序。按此顺序:
- java -jar microservice-demo-0.0.1-SNAPSHOT.jar 注册1111
- java -jar microservice-demo-0.0.1-SNAPSHOT.jar 账户2222
- java -jar microservice-demo-0.0.1-SNAPSHOT.jar web 3333
但是,当尝试通过使用 http://ACCOUNTS-SERVICE url 访问任何帐户服务端点(如 http://ACCOUNTS-SERVICE/accounts/123456789)的 Web 应用程序 (http://localhost:3333/) 访问任何服务时,我收到错误响应:
Response Status: 500 (Internal Server Error)
Cause: org.springframework.web.client.ResourceAccessException I/O error on GET request for "http://ACCOUNTS-SERVICE/accounts/123456789": ACCOUNTS-SERVICE; nested exception is java.net.UnknownHostException: ACCOUNTS-SERVICE
当我向 Web 服务器提供帐户服务的真实地址 (http://localhost:2223/) 而不是 http://ACCOUNTS-SERVICE 时,一切正常,但在这种情况下没有服务发现。
【问题讨论】:
标签: spring-boot spring-cloud netflix-eureka