Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
I am following Microservices from link:
https://github.com/sqshq/PiggyMetrics
. I was able to simply start the "config" service successfully, but when I tried to start the "registry" service, I got the below error.
Could anyone please guide on what is the issue ? I dont see any proper steps about setting or sequences to run the microservices.
2018-08-19 18:55:15.424 INFO 12700 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://config:8888
2018-08-19 18:55:17.805 INFO 12700 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Connect Timeout Exception on Url - http://config:8888. Will be trying the next url if available
2018-08-19 18:55:17.826 ERROR 12700 --- [ main] o.s.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:136) ~[spring-cloud-config-client-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:94) ~[spring-cloud-context-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:633) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:373) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:325) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) [spring-boot-2.0.3.RELEASE.jar:2.0.3.RELEASE]
at com.piggymetrics.registry.RegistryApplication.main(RegistryApplication.java:12) [classes/:na]
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://config:8888/registry/default": config; nested exception is java.net.UnknownHostException: config
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:732) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:680) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:600) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:218) ~[spring-cloud-config-client-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:96) ~[spring-cloud-config-client-2.0.0.RELEASE.jar:2.0.0.RELEASE]
... 7 common frames omitted
Caused by: java.net.UnknownHostException: config
at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_151]
at java.net.PlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_151]
at java.net.SocksSocketImpl.connect(Unknown Source) ~[na:1.8.0_151]
at java.net.Socket.connect(Unknown Source) ~[na:1.8.0_151]
at java.net.Socket.connect(Unknown Source) ~[na:1.8.0_151]
at sun.net.NetworkClient.doConnect(Unknown Source) ~[na:1.8.0_151]
at sun.net.www.http.HttpClient.openServer(Unknown Source) ~[na:1.8.0_151]
at sun.net.www.http.HttpClient.openServer(Unknown Source) ~[na:1.8.0_151]
at sun.net.www.http.HttpClient.<init>(Unknown Source) ~[na:1.8.0_151]
at sun.net.www.http.HttpClient.New(Unknown Source) ~[na:1.8.0_151]
at sun.net.www.http.HttpClient.New(Unknown Source) ~[na:1.8.0_151]
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source) ~[na:1.8.0_151]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source) ~[na:1.8.0_151]
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) ~[na:1.8.0_151]
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source) ~[na:1.8.0_151]
at org.springframework.http.client.SimpleBufferingClientHttpRequest.executeInternal(SimpleBufferingClientHttpRequest.java:76) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:723) ~[spring-web-5.0.7.RELEASE.jar:5.0.7.RELEASE]
... 11 common frames omitted
–
–
You have provided 'config' as the hostname of config service. Replace it with proper hostname.
spring:
application:
name: <name>
cloud:
config:
uri: http://host:port
fail-fast: true
password: <password>
username: <user>
Since the application is not able to resolve 'config', it is giving you UnknownHost Exception.
–
–
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.