com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server

后端 未结 10 1617
眼角桃花
眼角桃花 2020-12-30 19:32

I am very new to the microservices and trying to run the code from link: https://dzone.com/articles/advanced-microservices-security-with-spring-and-oa . When I simply run th

相关标签:
10条回答
  • 2020-12-30 20:09

    Look for the filterType() in ZuulLoggingFiler.java. I had the same problem. Then i saw my filter was returning null. so I changed it to "post" and it worked.

    @Override
    public String filterType() {
        // TODO Auto-generated method stub
        return "post";
    }
    
    0 讨论(0)
  • 2020-12-30 20:11

    You need to create Eureka Registry Server which is another microservice. It's main class incase of an SpringBoot application, should have @EnableEurekaServer annotation.

    Then in your Eureka Client you will have to mention the Registry server URL in appliation.yml as below :

    spring:
      application:
        name: stock-service
    
    server:
      port: 8083
    
    
    eureka:
      client:
        registerWithEureka: true
        fetchRegistry: true
        serviceUrl:
          defaultZone: http://localhost:8084/eureka/
      instance:
        hostname: localhost
    

    where defaultzone should hold the value of your Eureka Registry.

    Once you do all these configurations you need to Get the Eureka Registry microservice up and then you can get the Eureka client up. Once your Registry is up you will not face this exception.

    0 讨论(0)
  • 2020-12-30 20:16

    Similar error will be thrown when you have misspelled anything in the value of defaultZone. For ex: someone has misspelled eureka to euraka. Double check it.

    defaultZone : http://localhost:8761/eureka
    
    0 讨论(0)
  • 2020-12-30 20:17

    I find I have to add these two applications to the appllication.properties,it can work.Only one is not enough.

    eureka.client.register-with-eureka=false
    
    eureka.client.fetch-registry=false
    
    0 讨论(0)
  • 2020-12-30 20:18

    for me its working after connecting to internet because it need to download some dependence first time.

    0 讨论(0)
  • 2020-12-30 20:21

    This particular message is just a warning. Your application is attempting to register with Eureka but Eureka is not responding. You can either start an instance of Eureka or disable the automatic registration by adding the following to your application.yml.

    eureka:
      client:
        register-with-eureka: false
    
    0 讨论(0)
提交回复
热议问题