While I am trying to reach the service meeting
via Zuul gateway, Zuul is unable to forward the request to the respective service. The following errors are what I am facing:
- nettflix.zuul.exception.ZuulException: Forwarding error
- Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: meeting
Let me share the application.yml for the service, eureka and zuul gateway.
EurekaClient:
Application.yml
server:
port: 8761
eureka:
instance:
hostname: localhost
lease-renewal-interval-in-seconds: 300
client:
register-with-eureka: false
fetch-registry: true
serviceUrl:
defaultZone: http://localhost:8761/eureka/
ZuulGateWay:
application.yml
server:
port: 8085
spring:
application:
name: gatekeeper
zuul:
routes:
meeting: /meeting/**
serviceId: meeting
ribbon:
eureka:
enabled: false
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
ZuulGateWay: SpringBootApplication
package com.sagarp.gatekeeper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
@SpringBootApplication
@EnableEurekaClient
@EnableZuulProxy
public class MeetingApplication {
public static void main(String[] args) {
SpringApplication.run(MeetingApplication.class, args);
}
}
My Service class (meeting): Application.yml
server:
port: 0
spring:
application:
name: meeting
datasource:
url: jdbc:mysql://localhost:3306/sagarp?useSSL=false
username: myUserName
password: myPassWord
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
hibernate:
ddl-auto: update
eureka:
client:
registerWithEureka: true
fetchRegistry: true
serviceUrl:
defaultZone: http://localhost:8761/eureka/
instance:
lease-renewal-interval-in-seconds: 5
My Service class (meeting): SpringBootApplication
package com.sagarp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@SpringBootApplication
@EnableEurekaClient
public class MeetingApplication {
public static void main(String[] args) {
SpringApplication.run(MeetingApplication.class, args);
}
}
As you can see, the configuration ensures that all my services are discovered by eureka client.
In the eureka console, I have verified the same, the zuul gateway
and my service(meeting)
both are visible.
For better view, you can visit my git repo. https://github.com/sagar-patro/demo-microservices
Any help would be very much appreciable
ribbon
Zuul should be able to lad balance right. – Meisel