#Need help with error related to eureka with spring boot

5 messages · Page 1 of 1 (latest)

kind relic
#

2026-06-17T11:17:19.608+05:30 ERROR 7436 --- [Eureka] [get_localhost-5] c.n.e.cluster.ReplicationTaskProcessor : Network level connection to peer localhost; retrying after delay

jakarta.ws.rs.ProcessingException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: getsockopt

i get this log whenever i start a service that tries to register itself with eureka, earlier i thought iwas getting this because of restclient call with wrong config so i changed it to:

@Configuration
@Slf4j
public class RestClientConfig {

    @Bean("loadBalancedBuilder")
    @LoadBalanced
    public RestClient.Builder loadBalancedRestClientBuilder() {
        log.info("LoadBalancedRestClientBuilder");
        return RestClient.builder();
    }

    @Bean("defaultBuilder")
    @Primary
    public RestClient.Builder restClientBuilder() {
        log.info("RestClientBuilder");
        return RestClient.builder();
    }
}

now restclient call works (it uses service name from eureka), kafka works but i also added api-gateway which only work for following config:

              id: user-service
              predicates:
                - Path=/user/**
              uri: http://localhost:8081                               #and not lb://USER-SERVICE

what could be the reason, all service using restclient are already using proper config for restclient so what now?

balmy craneBOT
#

<@&1004656351647117403> please have a look, thanks.

kind relic
#

solved the error, eureka was trying to create replication server and connect with it to sync registery

#

this is a common behavior of eureka, usually config look like this

spring:
  application:
    name: Eureka
eureka:
  client:
    register-with-eureka: false
    fetch-registry: false

server:
  port: 8080
``` for eureka server

but to avoid replication (only for standalone eureka server), we also need to include:
```yml
eureka:
  service:
    service-url:
      defaultZone: http://localhost:8080/eureka/
``` this stops eureka from finding connection to sync registery
balmy craneBOT
#

Closed the thread.