18

When I start my Spring Cloud Config Server I get the following error.

Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/configserver/default/master":Connection refused; nested exception is java.net.ConnectException: Connection refused

However when I hit that URL in my browser it exists and the config server is working. What is going on?

application.yml

server:
  port: 8888
management:
  context-path: /admin
logging:
  level:
    com.netflix.discovery: 'OFF'
    org.springframework.cloud: 'DEBUG'
spring:
  cloud:
    config:
      server:
        git:
          uri: file:/home/dev/configs     

bootstrap.yml

spring:
  application:
    name: configserver
Brian Abston
  • 601
  • 3
  • 7
  • 15

4 Answers4

12

If your config server is not intended to be a config client as well you need to set spring.cloud.config.enabled=false to avoid that log entry (it's harmless though).

Dave Syer
  • 56,583
  • 10
  • 155
  • 143
  • 2
    Thanks for the answer. One more question. If that config exists then why do I get the error on startup? I would like the config server to also be also a client. – Brian Abston Feb 07 '15 at 17:29
  • 1
    You mean you want it to load its own properties from its repository? Try `spring.cloud.config.server.bootstrap=true`. – Dave Syer Feb 07 '15 at 17:58
  • When I put `spring.cloud.config.enabled=false` the error goes away but that means it isn't reading from the repository. If I have an application.yml and configserver.yml in the repository can the config server read from the repository and use the values on startup if it is the only config server? Sorry I haven't been real clear on what I am trying to figure out. – Brian Abston Feb 09 '15 at 16:18
  • Did you try `spring.cloud.config.server.bootstrap=true` or not? – Dave Syer Feb 09 '15 at 17:08
  • Yes. I tried `spring.cloud.config.server.bootstrap=true` in bootstrap.yml and the error persisted. – Brian Abston Feb 09 '15 at 17:37
  • `Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/configserver/default/master":Connection refused; nested exception is java.net.ConnectException: Connection refused` – Brian Abston Feb 09 '15 at 17:38
  • That's expected (as I said above). You can switch it off with `spring.cloud.config.enabled=false`. I feel like I didn't understand yet what you wanted to do. – Dave Syer Feb 09 '15 at 18:12
  • Let me see if giving an example would help clarify what I am trying to do. Currently in my config server project application.yml file I have security.user.password=blah. I would like to put this in the application.yml file in the repository and have the config server read from that on startup. This way I could change the password by simply checking in a new yml file into git. – Brian Abston Feb 09 '15 at 19:03
  • That's what the bootstrap property is for. Of course, just committing a change in git doesn't change the security of your config server (that would need a restart by default). – Dave Syer Feb 10 '15 at 06:49
  • Correct. I would also restart the server for the password change to take effect. So how can I get the config server to bootstrap from a config in the repo? – Brian Abston Feb 10 '15 at 12:53
  • 1
    By setting `spring.cloud.config.server.bootstrap=true` (in `bootstrap.yml`). – Dave Syer Feb 10 '15 at 14:52
  • That worked Dave. I thought I tried this before but I may done something incorrect. Thanks for sticking with me in this thread. – Brian Abston Feb 10 '15 at 15:46
0

This error is shown when one of your services is not able to connect to the cloud-config server. In order to make it work. I assume you are using STS or any Eclipse environment, run your cloud-config server application and then run the other service whose configurations are stored at the cloud-config. It is very important to keep running both the services. Other precautions that need to be taken care of are: your application's application.properties file should be renamed to bootstrap.properties' and port should not be used by any other services

0

One of the cases is that: the config server is not able to pull configurations from git repository.

Check git credential:

May be an invalid git credential.

OR

May be the git user has not have proper permission (Guest account)

enter image description here

Imranmadbar
  • 4,681
  • 3
  • 17
  • 30
-6

The eureka.client.serviceUrl.defaultZone and spring.cloud.config.* configuration in the bootstrap yml file

MD XF
  • 7,860
  • 7
  • 40
  • 71
谢晓义
  • 1
  • 1