Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I can't access the service through its application.name - Eureka

Eureka Sever registers all my services, however when trying to access them through their application.name I cannot, I have tried RestTemplate and OpenFeign but it has not been possible in any way.

enter image description here

When FEATURES-SERVICE requests an image from IMAGES-SERVICE through: http://localhost:9005 work, but when FEATURES-SERVICE requests an image from IMAGES-SERVICE through: http://images-service fail.

This is my config for eureka-server:

server:
  port: 8761

eureka:
  client:
    fetch-registry: false
    register-with-eureka: false

and config for features-service and images-service

// IMAGES-SERVICE
server:
  port:9005
spring:
  application:
    name: images-service

eureka:
  client:
    fetch-registry: true
    register-with-eureka: true
    service-url:
      default-zone: http://localhost:8761/eureka
    instance:
      hostname: localhost 

// FEATURES-SERVICE
server:
  port:9004
spring:
  application:
    name: features-service

eureka:
  client:
    fetch-registry: true
    register-with-eureka: true
    service-url:
      default-zone: http://localhost:8761/eureka
    instance:
      hostname: localhost 

both services has the annotation @EnableEurekaClient in the Application file.

like image 811
Juan Rojas Avatar asked Feb 02 '26 10:02

Juan Rojas


1 Answers

I was facing the same issue while using rest template and calling the other service, I got it running using the annotation @LoadBalanced on RestTemplate bean in my application class.

like image 182
amar2108 Avatar answered Feb 03 '26 23:02

amar2108



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!