SpringCloud错误总结

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_32447301/article/details/82790779

1.com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
原因: 原因是 Eureka服务注册中心也会将自己作为客户端来尝试注册它自己,所以我们需要禁用它的客户端注册行为
解决:
在application.yml 添加配置

eureka:
  client:
    service-url:
       defaultZone: http://localhost:8080/eureka/
    #所以我们需要禁用它的客户端注册行为
    register-with-eureka: false
    fetch-registry: false

2.
eureka client 启动报错:Invocation of destroy method failed on bean with name ‘scopedTarget.eurekaClient’: org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name ‘eurekaInstanceConfigBean’: Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)

解决:
在pom.xml 添加配置

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

3.配置读取出现Could not locate PropertySource: I/O error on GET request
解决:查看hosts的代理是否正确或者有多余的地址映射

4.com.netflix.zuul.exception.ZuulException: Forwarding error
解决:
在application.yml上添加

hystrix:
  command:
    default:
      execution:
        isolation:
          thread:
            timeoutInMilliseconds: 60000 

ribbon:  
  ReadTimeout: 60000  
  ConnectTimeout: 60000  

zuul:
  host: 
    connect-timeout-millis: 10000
    socket-timeout-millis: 60000

待续…

猜你喜欢

转载自blog.csdn.net/qq_32447301/article/details/82790779