Nacos longPolling error,Nacos1.4.1服务配置文件更新一次后报错
Nacos longPolling error,Nacos longPolling error,Nacos 服务配置只能更新一次
Nacos1.4.1 RejectedExecutionException,Nacos1.4.1服务配置文件更新一次后报错
================================
?Copyright 蕃薯耀 2021-03-25
https://www.cnblogs.com/fanshuyao/
一、问题描述
Nacos1.4.1报错: longPolling error
Nacos1.4.1报错:java.util.concurrent.RejectedExecutionException
Nacos作为服务配置中心时,在nacos-server-1.4.1配置列表增加了相应的配置文件,在应用启动时能主动获取到配置文件进行更新,但在nacos-server-1.4.1修改了配置属性后,更新了配置,但控制台也报错,Nacos后面再也无法更新。
nacos报错:java.util.concurrent.RejectedExecutionException
2021-03-23 17:29:49.084 ERROR 15256 --- [-127.0.0.1_8848] c.a.n.client.config.impl.ClientWorker : longPolling error : java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@e05e42 rejected from java.util.concurrent.ScheduledThreadPoolExecutor@ba59c84[Shutting down, pool size = 1, active threads = 1, queued tasks = 0, completed tasks = 1] at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:2063) ~[na:1.8.0_241] at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:830) [na:1.8.0_241] at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:326) ~[na:1.8.0_241] at java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:533) ~[na:1.8.0_241] at java.util.concurrent.ScheduledThreadPoolExecutor.execute(ScheduledThreadPoolExecutor.java:622) ~[na:1.8.0_241] at com.alibaba.nacos.client.config.impl.ClientWorker$LongPollingRunnable.run(ClientWorker.java:635) ~[nacos-client-1.4.1.jar:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_241] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_241] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_241] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_241] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_241] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_241] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_241]
二、解决方案
网上的都是旧的,说什么是Mdb5不一致的问题,或者是要配置登录的账号和密码,其实是不对的。
Nacos1.4.1报错: longPolling error:真正的原因是版本不一致导致的。
Nacos1.4.1报错: longPolling error 正确的解决方案:
spring-cloud-alibaba-dependencies的版本必须使用:2.2.5.RELEASE,版本2.2.4.RELEASE都会报错。即spring-cloud-starter-alibaba-nacos-config的版本是:2.2.5.RELEASE
<dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloudgroupId> <artifactId>spring-cloud-dependenciesartifactId> <version>${spring-cloud.version}version> <type>pomtype> <scope>importscope> dependency> <dependency> <groupId>com.alibaba.cloudgroupId> <artifactId>spring-cloud-alibaba-dependenciesartifactId> <version>2.2.5.RELEASEversion> <type>pomtype> <scope>importscope> dependency> dependencies> dependencyManagement>
修改完版本后,一切都正常。折腾了好久::>_<::
对应的版本信息:
官网版本说明:
https://github.com/alibaba/spring-cloud-alibaba/wiki/%E7%89%88%E6%9C%AC%E8%AF%B4%E6%98%8E
组件版本关系
Spring Cloud Alibaba Version | Sentinel Version | Nacos Version | RocketMQ Version | Dubbo Version | Seata Version |
---|---|---|---|---|---|
2.2.5.RELEASE or 2.1.4.RELEASE or 2.0.4.RELEASE |
1.8.0 |
1.4.1 |
4.4.0 |
2.7.8 |
1.3.0 |
2.2.3.RELEASE or 2.1.3.RELEASE or 2.0.3.RELEASE |
1.8.0 |
1.3.3 |
4.4.0 |
2.7.8 |
1.3.0 |
2.2.1.RELEASE or 2.1.2.RELEASE or 2.0.2.RELEASE |
1.7.1 |
1.2.1 |
4.4.0 |
2.7.6 |
1.2.0 |
2.2.0.RELEASE |
1.7.1 |
1.1.4 |
4.4.0 |
2.7.4.1 |
1.0.0 |
2.1.1.RELEASE or 2.0.1.RELEASE or 1.5.1.RELEASE |
1.7.0 |
1.1.4 |
4.4.0 |
2.7.3 |
0.9.0 |
2.1.0.RELEASE or 2.0.0.RELEASE or 1.5.0.RELEASE |
1.6.3 |
1.1.1 |
4.4.0 |
2.7.3 |
0.7.1 |
版本依赖关系(推荐使用)
Spring Cloud Version | Spring Cloud Alibaba Version | Spring Boot Version |
---|---|---|
Spring Cloud 2020.0 |
2020.0.RC1 |
2.4.2.RELEASE |
Spring Cloud Hoxton.SR8 |
2.2.5.RELEASE |
2.3.2.RELEASE |
Spring Cloud Greenwich.SR6 |
2.1.4.RELEASE |
2.1.13.RELEASE |
Spring Cloud Hoxton.SR3 |
2.2.1.RELEASE |
2.2.5.RELEASE |
Spring Cloud Hoxton.RELEASE |
2.2.0.RELEASE |
2.2.X.RELEASE |
Spring Cloud Greenwich |
2.1.2.RELEASE |
2.1.X.RELEASE |
Spring Cloud Finchley |
2.0.4.RELEASE |
2.0.X.RELEASE |
Spring Cloud Edgware |
1.5.1.RELEASE(停止维护,建议升级) |
1.5.X.RELEASE |
spring-cloud-alibaba-dependencies版本关系对应,截图如下:
(时间宝贵,分享不易,捐赠回馈,^_^)
================================
?Copyright 蕃薯耀 2021-03-25
https://www.cnblogs.com/fanshuyao/