Tag Archives: Configuration center

Springcloud configuration center client 3355 startup Error: error on get request for“ http://localhost:8761/eureka/apps/ “: Connection

The error contents are as follows:

error on GET request for "http://localhost:8761/eureka/apps/": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect stacktrace=org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8761/eureka/apps/": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
	at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:785)
	at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:711)
                            ...
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.DualStackPlainSocketImpl.connect0(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
     ...	

2022-01-08 22:16:56.800  WARN 15304 --- [           main] c.n.d.s.t.d.RetryableEurekaHttpClient    : Request execution failed with message: I/O error on GET request for "http://localhost:8761/eureka/apps/": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
2022-01-08 22:16:56.801  INFO 15304 --- [           main] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_UNKNOWN/windows10.microdone.cn - was unable to refresh its cache! This periodic background refresh will be retried in 30 seconds. status = Cannot execute request on any known server stacktrace = com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
		......

ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.configClientController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'config.info' in value "${config.info}"
2022-01-08 22:16:57.016  INFO 15304 --- [           main] com.netflix.discovery.DiscoveryClient    : Shutting down DiscoveryClient ...
2022-01-08 22:16:57.847  INFO 15304 --- [nfoReplicator-0] c.n.d.s.t.d.RedirectingEurekaHttpClient  : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}, exception=I/O error on POST request for "http://localhost:8761/eureka/apps/UNKNOWN": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect stacktrace=org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://localhost:8761/eureka/apps/UNKNOWN": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
	......
	
2022-01-08 22:16:57.847  WARN 15304 --- [nfoReplicator-0] c.n.d.s.t.d.RetryableEurekaHttpClient    : Request execution failed with message: I/O error on POST request for "http://localhost:8761/eureka/apps/UNKNOWN": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
2022-01-08 22:16:57.849  WARN 15304 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_UNKNOWN/windows10.microdone.cn - registration failed Cannot execute request on any known server

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

	......

2022-01-08 22:16:57.850  WARN 15304 --- [nfoReplicator-0] c.n.discovery.InstanceInfoReplicator     : There was a problem with the instance info replicator

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

		......	

2022-01-08 22:16:57.851  INFO 15304 --- [           main] com.netflix.discovery.DiscoveryClient    : Unregistering ...
2022-01-08 22:16:58.855  INFO 15304 --- [           main] c.n.d.s.t.d.RedirectingEurekaHttpClient  : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}, exception=I/O error on DELETE request for "http://localhost:8761/eureka/apps/UNKNOWN/windows10.microdone.cn": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect stacktrace=org.springframework.web.client.ResourceAccessException: I/O error on DELETE request for "http://localhost:8761/eureka/apps/UNKNOWN/windows10.microdone.cn": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
	com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.cancel(EurekaHttpClientDecorator.java:71)
Caused by: java.net.ConnectException: Connection refused: connect
	at java.net.DualStackPlainSocketImpl.connect0(Native Method)
	......

2022-01-08 22:16:58.855  WARN 15304 --- [           main] c.n.d.s.t.d.RetryableEurekaHttpClient    : Request execution failed with message: I/O error on DELETE request for "http://localhost:8761/eureka/apps/UNKNOWN/windows10.microdone.cn": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
2022-01-08 22:16:58.856 ERROR 15304 --- [           main] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_UNKNOWN/windows10.microdone.cn - de-registration failedCannot execute request on any known server

com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
	
		......
		
2022-01-08 22:16:59.013 ERROR 15304 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.configClientController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'config.info' in value "${config.info}"
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.3.7.jar:5.3.7]
	

Cause of problem:

Because my spring cloud version is too high, I lack related dependencies.

Solution:

Add the following dependencies to the spring cloud configuration center client POM file:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-bootstrap</artifactId>
    <version>3.1.0</version>
</dependency>

To illustrate, my spring cloud is version 2020.0.1, and the above dependencies should be added above the spring cloud g version.