Error registering service to eureka server

14,280

Solution 1

Looks like a dependency issue.

If the app works fine (the core functionality) without eureka integration, then try changing the eureka-client dependency version.

Solution 2

Add

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

into Eureka and client app

It really works !!!

Solution 3

Eureka client deregisters when an app has been shutdown.

Check if there is any other reason why the app is stopping leading to eureka-client deregistering.

For my case, the application was shutting down due to spring-boot-starter-web dependency. After resolving this, the application started well.

Share:
14,280
Admin
Author by

Admin

Updated on July 01, 2022

Comments

  • Admin
    Admin almost 2 years

    I am trying to register a client to spring-eureka-server, client deregisters just after registering

    eureka-server logs:

    2018-05-13 16:02:47.290 INFO 25557 --- [io-9091-exec-10] c.n.e.registry.AbstractInstanceRegistry : Registered instance HELLO-CLIENT/192.168.43.96:hello-client:8072 with status UP (replication=false) 2018-05-13 16:02:47.438 INFO 25557 --- [nio-9091-exec-3] c.n.e.registry.AbstractInstanceRegistry : Registered instance HELLO-CLIENT/192.168.43.96:hello-client:8072 with status DOWN (replication=false) 2018-05-13 16:02:47.457 INFO 25557 --- [nio-9091-exec-2] c.n.e.registry.AbstractInstanceRegistry : Cancelled instance HELLO-CLIENT/192.168.43.96:hello-client:8072 (replication=false) 2018-05-13 16:02:47.950 INFO 25557 --- [nio-9091-exec-5] c.n.e.registry.AbstractInstanceRegistry : Registered instance HELLO-CLIENT/192.168.43.96:hello-client:8072 with status DOWN (replication=true) 2018-05-13 16:02:47.951 INFO 25557 --- [nio-9091-exec-5] c.n.e.registry.AbstractInstanceRegistry : Cancelled instance HELLO-CLIENT/192.168.43.96:hello-client:8072 (replication=true) 2018-05-13 16:03:25.747 INFO 25557 --- [a-EvictionTimer] c.n.e.registry.AbstractInstanceRegistry : Running the evict task with compensationTime 4ms

    Eureka-client logs:

    2018-05-13 16:02:47.163 INFO 25676 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_HELLO-CLIENT/192.168.43.96:hello-client:8072: registering service... 2018-05-13 16:02:47.212 INFO 25676 --- [
    main] c.a.helloclient.HelloClientApplication : Started HelloClientApplication in 7.62 seconds (JVM running for 8.573) 2018-05-13 16:02:47.224 INFO 25676 --- [ Thread-5] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@6f7923a5: startup date [Sun May 13 16:02:42 IST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@5c30a9b0 2018-05-13 16:02:47.226 INFO 25676 --- [ Thread-5] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application hello-client with eureka with status DOWN 2018-05-13 16:02:47.227 WARN 25676 --- [ Thread-5] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1526207567227, current=DOWN, previous=UP] 2018-05-13 16:02:47.232 INFO 25676 --- [ Thread-5] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 0 2018-05-13 16:02:47.235 INFO 25676 --- [ Thread-5] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ... 2018-05-13 16:02:47.292 INFO 25676 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_HELLO-CLIENT/192.168.43.96:hello-client:8072 - registration status: 204 2018-05-13 16:02:47.423 INFO 25676 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_HELLO-CLIENT/192.168.43.96:hello-client:8072: registering service... 2018-05-13 16:02:47.440 INFO 25676 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_HELLO-CLIENT/192.168.43.96:hello-client:8072 - registration status: 204 2018-05-13 16:02:47.442 INFO 25676 --- [
    Thread-5] com.netflix.discovery.DiscoveryClient : Unregistering ... 2018-05-13 16:02:47.460 INFO 25676 --- [ Thread-5] com.netflix.discovery.DiscoveryClient : DiscoveryClient_HELLO-CLIENT/192.168.43.96:hello-client:8072 - deregister status: 200 2018-05-13 16:02:47.494 INFO 25676 --- [
    Thread-5] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient 2018-05-13 16:02:47.495 INFO 25676 --- [
    Thread-5] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown 2018-05-13 16:02:47.498 INFO 25676 --- [ Thread-5] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans

    Please let me know what could be possibly wrong.