Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not locate PropertySource: I/O error on GET request

I have created a simple new project intellij with Spring Initilizer using start.spring.io and i added DevTools Acuator Config Client and Web as the configurations.

Here is my POM file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <groupId>com.in28minutes.microservices</groupId>
   <artifactId>limits-service</artifactId>
   <version>0.0.1-SNAPSHOT</version>
   <packaging>jar</packaging>

   <name>limits-service</name>
   <description>Demo project for Spring Boot</description>

   <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>1.5.10.RELEASE</version>
      <relativePath/> <!-- lookup parent from repository -->
   </parent>

   <properties>
      <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
      <java.version>1.8</java.version>
      <spring-cloud.version>Edgware.SR1</spring-cloud.version>
   </properties>

   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-actuator</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.cloud</groupId>
         <artifactId>spring-cloud-starter-config</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-web</artifactId>
      </dependency>

      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-devtools</artifactId>
         <scope>runtime</scope>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-test</artifactId>
         <scope>test</scope>
      </dependency>
   </dependencies>

   <dependencyManagement>
      <dependencies>
         <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>${spring-cloud.version}</version>
            <type>pom</type>
            <scope>import</scope>
         </dependency>
      </dependencies>
   </dependencyManagement>

   <build>
      <plugins>
         <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
         </plugin>
      </plugins>
   </build>


</project>

But when i am running the app, it builds but i am getting the following warning. Anybody has any idea what i am not doing right?

Fetching config from server at: http://localhost:8888
2018-01-31 16:41:54.818  WARN 10760 --- [on(2)-127.0.0.1] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/application/default": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
like image 684
Madu Avatar asked Jan 31 '18 14:01

Madu


2 Answers

See resolution here (Spring Cloud Config Server Can't locate PropertySource on startup) from Dave Syer

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).

like image 118
BrianC Avatar answered Sep 29 '22 12:09

BrianC


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:

Assuming that 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
  • The port should not be used by any other services
like image 38
Saket Sourav Avatar answered Sep 29 '22 13:09

Saket Sourav