Java – Unable to register service with discovery server (EUREKA)

Unable to register service with discovery server (EUREKA)… here is a solution to the problem.

Unable to register service with discovery server (EUREKA)

So when I run my service instance. It does not register itself with the discovery server. And there are no errors, so I can’t identify the problem here.

My service’s application.properties

looks like this, and the discovery server’s application.properties can be seen in the attached screenshot.

spring.application.name = service
eureka.client.service-url.defaultZone =http://localhost:8761/eureka/

The

Eureka dashboard at localhost:8761 shows that there are no instances available for this service.

This is the console

Solution

You must add this dependency in your pom.xml, which will give your service a reason to keep running:

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

Also, I think you should refactor your application.properties file for the Eureka default zone section as follows:

eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka/
eureka.instance.preferIpAddress=true
eureka.client.registerWithEureka=true
eureka.client.fetchRegistry=true

Related Problems and Solutions