Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Working With Eureka Clients Programmatically issue - Completed shut down of DiscoveryClient

I've createde Eureka server with the replication and now trying to start the client. When I'm trying to start the spring-microservices-eureka-client, I get the below error. Using Spring Boot Version 2.1.1.RELEASE. The same error is coming with the Boot Version 2.0.7.RELEASE and Finchley.SR2.

2018-12-28 13:52:16.741  INFO 20236 --- [           main] o.s.c.n.e.s.EurekaServiceRegistry        : Registering application UNKNOWN with eureka with status UP
2018-12-28 13:52:16.742  INFO 20236 --- [           main] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [timestamp=1545985336742, current=UP, previous=STARTING]
2018-12-28 13:52:16.743  INFO 20236 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_UNKNOWN/841DTN2.corp.abc.org: registering service...
2018-12-28 13:52:16.749  INFO 20236 --- [           main] ringMicroservicesEurekaClientApplication : Started SpringMicroservicesEurekaClientApplication in 3.335 seconds (JVM running for 4.12)
2018-12-28 13:52:16.752  INFO 20236 --- [       Thread-6] o.s.c.n.e.s.EurekaServiceRegistry        : Unregistering application UNKNOWN with eureka with status DOWN
2018-12-28 13:52:16.752  WARN 20236 --- [       Thread-6] com.netflix.discovery.DiscoveryClient    : Saw local status change event StatusChangeEvent [timestamp=1545985336752, current=DOWN, previous=UP]
2018-12-28 13:52:16.756  INFO 20236 --- [       Thread-6] com.netflix.discovery.DiscoveryClient    : Shutting down DiscoveryClient ...
2018-12-28 13:52:16.788  INFO 20236 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_UNKNOWN/841DTN2.corp.abc.org - registration status: 204
2018-12-28 13:52:16.789  INFO 20236 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_UNKNOWN/841DTN2.corp.abc.org: registering service...
2018-12-28 13:52:16.793  INFO 20236 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_UNKNOWN/841DTN2.corp.abc.org - registration status: 204
2018-12-28 13:52:16.793  INFO 20236 --- [       Thread-6] com.netflix.discovery.DiscoveryClient    : Unregistering ...
2018-12-28 13:52:16.799  INFO 20236 --- [       Thread-6] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_UNKNOWN/841DTN2.corp.abc.org - deregister  status: 200
2018-12-28 13:52:16.805  INFO 20236 --- [       Thread-6] com.netflix.discovery.DiscoveryClient    : Completed shut down of DiscoveryClient

spring-microservices-eureka-server application.yml

---
spring:
  profiles: peer1
server:
  port: 8761
eureka:
  instance:
    hostname: peer1
  client:
    service-url:
      defaultZone: http://peer2:8762/eureka
    register-with-eureka: false
    fetch-registry: false

---
spring:
  profiles: peer2
server:
  port: 8762
eureka:
  instance:
    hostname: peer2
  client:
    service-url:
      defaultZone: http://peer1:8761/eureka
    register-with-eureka: false
    fetch-registry: false

SpringMicroservicesEurekaServerApplication.java

@EnableEurekaServer
@SpringBootApplication
public class SpringMicroservicesEurekaServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(SpringMicroservicesEurekaServerApplication.class, args);
    }
}

pom.mxl

<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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.oreilly.cloud</groupId>
    <artifactId>spring-microservices-eureka-server</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring-microservices-eureka-server</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Greenwich.RC2</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
        </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>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
        </repository>
    </repositories>

spring-microservices-eureka-client

SpringMicroservicesEurekaClientApplication.java

@SpringBootApplication
@EnableEurekaClient
public class SpringMicroservicesEurekaClientApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringMicroservicesEurekaClientApplication.class, args);
    }
}

Reference issue: https://github.com/spring-cloud/spring-cloud-netflix/issues/2099 - This look major issue to me.

pom.xml

<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>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.oreilly.cloud</groupId>
    <artifactId>spring-microservices-eureka-client</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring-microservices-eureka-client</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
        <spring-cloud.version>Greenwich.RC2</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </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>

    <repositories>
        <repository>
            <id>spring-milestones</id>
            <name>Spring Milestones</name>
            <url>https://repo.spring.io/milestone</url>
        </repository>
    </repositories>
</project>
like image 861
PAA Avatar asked Dec 24 '22 02:12

PAA


1 Answers

I was able to solve this issue by adding the web dependency

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

enter image description here

like image 151
PAA Avatar answered Dec 28 '22 06:12

PAA