问题描述
没有添加@CommonScan(“com.iooc”)
2018-12-13 17:06:26.095 INFO 4004 --- [nio-8200-exec-2] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@56746b94: startup date [Thu Dec 13 17:06:26 CST 2018]; parent: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@31aab981
2018-12-13 17:06:26.569 INFO 4004 --- [nio-8200-exec-2] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-12-13 17:06:28.055 INFO 4004 --- [nio-8200-exec-2] c.netflix.config.ChainedDynamicProperty : Flipping property: product.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2018-12-13 17:06:28.195 INFO 4004 --- [nio-8200-exec-2] c.n.u.concurrent.ShutdownEnabledTimer : Shutdown hook installed for: NFLoadBalancer-PingTimer-product
2018-12-13 17:06:28.257 INFO 4004 --- [nio-8200-exec-2] c.netflix.loadbalancer.BaseLoadBalancer : Client: product instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=product,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
2018-12-13 17:06:28.284 INFO 4004 --- [nio-8200-exec-2] c.n.l.DynamicServerListLoadBalancer : Using serverListUpdater PollingServerListUpdater
2018-12-13 17:06:28.381 INFO 4004 --- [nio-8200-exec-2] c.netflix.config.ChainedDynamicProperty : Flipping property: product.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2018-12-13 17:06:28.388 INFO 4004 --- [nio-8200-exec-2] c.n.l.DynamicServerListLoadBalancer : DynamicServerListLoadBalancer for client product initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=product,current list of Servers=[WIN-MEHPHOPOV1M:8300],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone; Instance count:1; Active connections count: 0; Circuit breaker tripped count: 0; Active connections per server: 0.0;]
},Server stats: [[Server:WIN-MEHPHOPOV1M:8300; Zone:defaultZone; Total Requests:0; Successive connection failure:0; Total blackout seconds:0; Last connection made:Thu Jan 01 08:00:00 CST 1970; First connection made: Thu Jan 01 08:00:00 CST 1970; Active Connections:0; total failure count in last (1000) msecs:0; average resp time:0.0; 90 percentile resp time:0.0; 95 percentile resp time:0.0; min resp time:0.0; max resp time:0.0; stddev resp time:0.0]
]}ServerList:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@1b150cef
2018-12-13 17:06:29.291 INFO 4004 --- [erListUpdater-0] c.netflix.config.ChainedDynamicProperty : Flipping property: product.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2018-12-13 17:06:55.113 ERROR 4004 --- [nio-8200-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is feign.RetryableException: Connection refused: connect executing POST http://product/product/listForOrder] with root cause
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_191]
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[na:1.8.0_191]
添加@CommonScan(“com.iooc”)
同时通过查看spring目前的bean列表也查询到 ProductClientFallback 这个bean已经加载到了上下文
2018-12-13 17:11:04.389 INFO 7212 --- [nio-8200-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2018-12-13 17:11:04.389 INFO 7212 --- [nio-8200-exec-2] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2018-12-13 17:11:04.424 INFO 7212 --- [nio-8200-exec-2] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 35 ms
2018-12-13 17:11:08.407 INFO 7212 --- [nio-8200-exec-2] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@457c9b8e: startup date [Thu Dec 13 17:11:08 CST 2018]; parent: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@391d1e33
2018-12-13 17:11:08.441 INFO 7212 --- [nio-8200-exec-2] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2018-12-13 17:11:08.614 INFO 7212 --- [nio-8200-exec-2] c.netflix.config.ChainedDynamicProperty : Flipping property: product.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2018-12-13 17:11:08.630 INFO 7212 --- [nio-8200-exec-2] c.n.u.concurrent.ShutdownEnabledTimer : Shutdown hook installed for: NFLoadBalancer-PingTimer-product
2018-12-13 17:11:08.648 INFO 7212 --- [nio-8200-exec-2] c.netflix.loadbalancer.BaseLoadBalancer : Client: product instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=product,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
2018-12-13 17:11:08.653 INFO 7212 --- [nio-8200-exec-2] c.n.l.DynamicServerListLoadBalancer : Using serverListUpdater PollingServerListUpdater
2018-12-13 17:11:08.657 INFO 7212 --- [nio-8200-exec-2] c.n.l.DynamicServerListLoadBalancer : DynamicServerListLoadBalancer for client product initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=product,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList@4f9e2dcc
2018-12-13 17:11:08.765 ERROR 7212 --- [nio-8200-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: com.netflix.client.ClientException: Load balancer does not have available server for client: product] with root cause
com.netflix.client.ClientException: Load balancer does not have available server for client: product
at com.netflix.loadbalancer.LoadBalancerContext.getServerFromLoadBalancer(LoadBalancerContext.java:483) ~[ribbon-loadbalancer-2.2.2.jar:2.2.2]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:184) ~[ribbon-loadbalancer-2.2.2.jar:2.2.2]
at com.netflix.loadbalancer.reactive.LoadBalancerCommand$1.call(LoadBalancerCommand.java:180) ~[ribbon-loadbalancer-2.2.2.jar:2.2.2]
SpringCloud组件实现微服务,【已升级Finchley.Release】
了解课程