SpringCloud-11-解决[NACOS HTTP-GET] The maximum number of tolerable server reconnection errors has bee

这篇具有很好参考价值的文章主要介绍了SpringCloud-11-解决[NACOS HTTP-GET] The maximum number of tolerable server reconnection errors has bee。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

错误日志显示的是nacos的服务数量已达最大,实际原因是配置中心出问题了。

若仅使用了nacos的发现功能(discovery),则不需要引入配置依赖“spring-cloud-starter-alibaba-nacos-config”,否则将会报错,如下:

[2022-10-17 15:01:42] [INFO ] -- LOCAL_SNAPSHOT_PATH:/root/nacos/config
[2022-10-17 15:01:42] [INFO ] -- limitTime:5.0
[2022-10-17 15:01:42] [ERROR] -- [NACOS ConnectException httpGet] currentServerAddr:http://localhost:8848, err : Connection refused (Connection refused)
[2022-10-17 15:01:42] [ERROR] -- [NACOS ConnectException httpGet] currentServerAddr:http://localhost:8848, err : Connection refused (Connection refused)
[2022-10-17 15:01:42] [ERROR] -- [NACOS ConnectException httpGet] currentServerAddr:http://localhost:8848, err : Connection refused (Connection refused)
[2022-10-17 15:01:42] [ERROR] -- [NACOS ConnectException httpGet] currentServerAddr:http://localhost:8848, err : Connection refused (Connection refused)
[2022-10-17 15:01:42] [ERROR] -- [fixed-localhost_8848] [sub-server] get server config exception, dataId=modelwenzhou, group=DEFAULT_GROUP, tenant=
java.net.ConnectException: [NACOS HTTP-GET] The maximum number of tolerable server reconnection errors has been reached
        at com.alibaba.nacos.client.config.http.ServerHttpAgent.httpGet(ServerHttpAgent.java:125)
        at com.alibaba.nacos.client.config.http.MetricsHttpAgent.httpGet(MetricsHttpAgent.java:51)
        at com.alibaba.nacos.client.config.impl.ClientWorker.getServerConfig(ClientWorker.java:274)
        at com.alibaba.nacos.client.config.NacosConfigService.getConfigInner(NacosConfigService.java:155)
        at com.alibaba.nacos.client.config.NacosConfigService.getConfig(NacosConfigService.java:98)
        at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.loadNacosData(NacosPropertySourceBuilder.java:85)
        at com.alibaba.cloud.nacos.client.NacosPropertySourceBuilder.build(NacosPropertySourceBuilder.java:73)
        at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosPropertySource(NacosPropertySourceLocator.java:199)
        at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadNacosDataIfPresent(NacosPropertySourceLocator.java:186)
        at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.loadApplicationConfiguration(NacosPropertySourceLocator.java:141)
        at com.alibaba.cloud.nacos.client.NacosPropertySourceLocator.locate(NacosPropertySourceLocator.java:103)
        at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:51)
        at org.springframework.cloud.bootstrap.config.PropertySourceLocator.locateCollection(PropertySourceLocator.java:47)
        at org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.initialize(PropertySourceBootstrapConfiguration.java:95)
        at org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:639)
        at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:402)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:338)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1329)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1318)
        at com.caipos.WenzhouModelApp.main(WenzhouModelApp.java:34)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
[2022-10-17 15:01:42] [WARN ] -- [fixed-localhost_8848] [get-config] get from server error, dataId=modelwenzhou, group=DEFAULT_GROUP, tenant=, msg=ErrCode:500, ErrMsg:[NACOS HTTP-GET] The maximum number of tolerable server reconnection errors has been reached

解决办法1:

移除config依赖:

<!-- nacos-config -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
        </dependency>

解决办法2:

bootstrap.yml中将config关闭:文章来源地址https://www.toymoban.com/news/detail-532448.html

spring:
  application:
    name: modelServer
  cloud:
    nacos:
      discovery:
        server-addr: http://nacos:8848
      config:
        enabled: false

到了这里,关于SpringCloud-11-解决[NACOS HTTP-GET] The maximum number of tolerable server reconnection errors has bee的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包