3

I created a docker image and pushed it to docker hub. Now, I am trying to run it on a remote machine by using docker-compose and I get the following error.

java.lang.IllegalStateException: Could not locate PropertySource and the fail fast property is set, failing
my-test_1  |    at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:132)
my-test_1  |    at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:93)
my-test_1  |    at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:567)
my-test_1  |    at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:338)
my-test_1  |    at org.springframework.boot.SpringApplication.run(SpringApplication.java:301)
my-test_1  |    at net.ptidej.seodin.SeodinApp.main(SeodinApp.java:68)
my-test_1  |    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
my-test_1  |    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
my-test_1  |    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
my-test_1  |    at java.lang.reflect.Method.invoke(Method.java:498)
my-test_1  |    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
my-test_1  |    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
my-test_1  |    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
my-test_1  |    at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59)
my-test_1  | Caused by: org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8761/config/seodin/prod/master": Connection refused (Connection refused); nested exception is java.net.ConnectException: Connection refused (Connection refused)
my-test_1  |    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:674)
my-test_1  |    at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:621)
my-test_1  |    at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:539)
my-test_1  |    at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:172)
my-test_1  |    at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.locate(ConfigServicePropertySourceLocator.java:93)
my-test_1  |    ... 13 common frames omitted
my-test_1  | Caused by: java.net.ConnectException: Connection refused (Connection refused)
my-test_1  |    at java.net.PlainSocketImpl.socketConnect(Native Method)
my-test_1  |    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
my-test_1  |    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
my-test_1  |    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
my-test_1  |    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
my-test_1  |    at java.net.Socket.connect(Socket.java:589)
my-test_1  |    at java.net.Socket.connect(Socket.java:538)
my-test_1  |    at sun.net.NetworkClient.doConnect(NetworkClient.java:180)
my-test_1  |    at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
my-test_1  |    at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
my-test_1  |    at sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
my-test_1  |    at sun.net.www.http.HttpClient.New(HttpClient.java:339)
my-test_1  |    at sun.net.www.http.HttpClient.New(HttpClient.java:357)
my-test_1  |    at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
my-test_1  |    at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
my-test_1  |    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
my-test_1  |    at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
my-test_1  |    at org.springframework.http.client.SimpleBufferingClientHttpRequest.executeInternal(SimpleBufferingClientHttpRequest.java:78)
my-test_1  |    at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
my-test_1  |    at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
my-test_1  |    at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:112)
my-test_1  |    at org.springframework.cloud.config.client.ConfigServicePropertySourceLocator$GenericRequestHeaderInterceptor.intercept(ConfigServicePropertySourceLocator.java:237)
my-test_1  |    at org.springframework.http.client.InterceptingClientHttpRequest$InterceptingRequestExecution.execute(InterceptingClientHttpRequest.java:88)
my-test_1  |    at org.springframework.http.client.InterceptingClientHttpRequest.executeInternal(InterceptingClientHttpRequest.java:72)
my-test_1  |    at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48)
my-test_1  |    at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:53)
my-test_1  |    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:660)
my-test_1  |    ... 17 common frames omitted
my-test_1  | 

I am guessing it has something to do with ports in one of the config files, but I don't know which one. What is the meaning of this error and where should I look to resolve it? I would appreciate any lead/hint to the problem in the source code/config files. Thank you.

2 Answers 2

0

Your Spring Boot app is configured to load properties from a Spring Cloud Config server specified at

http://localhost:8761/config/seodin/prod/master

and it can't see it.

As you are running in Docker either make sure that a config server is running in Docker as well, and that your Spring Boot app is configured to point at that (the URL will not be localhost; it's likely to be the container name of the config server ifyou are running that in Docker, or the URL of an external config server)

Sign up to request clarification or add additional context in comments.

Comments

0

When you are inside of a Docker container, localhost resolves to that container not Docker Host. So you should change the IP address of the Config Server to Docker Host IP address or your LAN IP address in your application configurations. Of course it will work if you have a running Config Server in your machine.

3 Comments

Where can I find the Config Server IP defined to change it to Docker Host?
it can be spring.cloud.config.uri config in your application.properties or bootstrap.properties file. take a look at this link, it might be helpful.
Also there is another strange thing in your question. Port 8761 is standard port for Eureka Discovery Server and port 8888 is standard port for Configuration Server. But your logs shows that your app is trying to fetch it's configurations from Configuration Server at port 8761.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.