1.在项目运行时报错
2021年6月19日
发现是由于此处设置导致,将其改为1.8后正常启动。
2.添加依赖
2021年6月20日
Maven项目在pom.xml中快速添加依赖
- 在pom.xml中需要添加依赖的位置,使用快捷键alt+insert插入内容
- 选择Dependency
而我电脑F12键与insert键共用一键,使用快捷键fn+alt+insert
3. 无法解析依赖
Cannot resolve org.springframework.cloud:spring-cloud-starter-netflix-eureka-server:unknown
没有指定版本号,但是上一个项目也没规定版本号就能运行,原因未知
4.Service Instance cannot be null
在测试断路器Hystrix时报错
发现是少了@EnableCircuitBreaker注解的原因
但是理论上@SpringCloudApplication=@SpringBootApplication+@EnableDiscoveryClient+@EnableCircuitBreaker三个注解,查阅源码也没发现@EnableCircuitBreaker注解,可能是版本问题。
果然是版本问题,在老版本的SpringCloudApplication注解上就包含EnableCircuitBreaker注解。
5.hystrix-dashboard报错
监控界面无监控信息
IDEA控制台报错:
Origin parameter: http://localhost:3001/actuator/hystrix.stream is not in the allowed list of proxy host names. If it should be allowed add it to hystrix.dashboard.proxyStreamAllowList.
原因:未在yml中配置
hystrix:
dashboard:
proxy-stream-allow-list: localhost
6.在feign项目中yml配置了ConnectTimeout ReadTimeout与之前所学不同
但好像不生效
7.在feign项目中配置了ribbon和hystrix不生效
2021年6月21日
改正cloud和boot的版本号,上面的版本虽然正确对应,但就是不能用。
https://spring.io/projects/spring-cloud/#learn
8.feign注意事项
feign 没有包含完整的 hystrix 依赖,包含hystrix 降级,不包含 hystrix 熔断
9.在配置完之后order service 调用商品库存服务和用户服务报错
控制台报错java.net.SocketTimeoutException: Read timed out
hystrix dashboard 监控 order service 断路器无信息
原因:feign未配置 hystrix
feign:
hystrix:
enabled: true
所以,不走降级代码,显示Read timed out,hystrix dashboard没有显示信息。
10.Hystrix Dashboard加载不出信息
2021年6月22日
服务刚启动就是这样的,需要手动请求要监控的端口服务
11.访问 item-service-dev.yml 返回[]
2021年6月23日
使用以下形式访问 item-service-dev.yml
http://localhost:6001/item-service-dev.yml
原因yml中searchPaths未配置正确
会导致从Config加载配置文件时报错 No active profile set, falling back to default profiles: default
POST发送
>curl -X POST "http://localhost:8101/actuator/refresh"