解决SpringCloud的bug的神经历(持续更新中...)

2017-11-15  本文已影响0人  初晨的笔记

1、提供服务的项目已经注册到注册中心,当消费者调用的时候报无可用的服务com.netflix.client.ClientException: Load balancer does not have available server for client: taobao-item
解决办法:
(1)确定本机是否关闭防火墙
(2)是否导入eureka的jar包

                <dependency>
                      <groupId>org.springframework.cloud</groupId>
                      <artifactId>spring-cloud-starter-eureka</artifactId>
                </dependency>
(3)确定配置文件服务前面是否有空格 application.properties

本人因为第三个原因导致浪费整整一天

2、服务的消费者启动时bean注入不了报一下异常:

     org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'caseBaseInfoServiceImpl': Unsatisfied dependency expressed through field 'caseTestService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.winhc.mis.biz.caseBaseInfo.test.CaseTestService': FactoryBean threw exception on object creation; nested exception is java.lang.NullPointerException

原因:一般这种bean注入不了我们都会检查接口所在包是否可以启动被扫描到,但是都检查了没毛病,最后公司大神排除出swagger的jar包原因

解决方法:把swagger的依赖改为比较新的2.6.1

上一篇 下一篇

猜你喜欢

热点阅读