Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.2.3版本docker部署,服务启动时偶发:java.net.ConnectException: [NACOS HTTP-POST] The maximum number of tolerable server reconnection errors has been reached #12664

Closed
YS1127 opened this issue Sep 19, 2024 · 3 comments

Comments

@YS1127
Copy link

YS1127 commented Sep 19, 2024

作者们,你们好。目前遇到一个问题,咨询一下:docker部署nacos 2.2.3版本以及一个网关服务跟个业务服务,服务启动时候,业务服务会偶尔出现java.net.ConnectException: [NACOS HTTP-POST] The maximum number of tolerable server reconnection errors has been reached问题导致服务不可用。但是网关服务又正常,nacos也是正常的,重启业务服务又很正常。我想咨询下是什么原因导致的。下面是docker-compose.yml的内容:
version: '3'
networks:
front:
driver: bridge
back:
driver: bridge
services:
nginx-service:
restart: always
image: nginx:1.17.5
ports:
- 30000:80
depends_on:
- gateway
- kafka
networks:
- back
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
nacos:
restart: always
image: nacos/nacos-server:v2.2.3
ports:
- 8848:8848
- 9848:9848
depends_on:
- mysql
networks:
- back
volumes:
- ./nacos/application.yaml:/home/nacos/conf/application.properties
redis:
restart: always
image: redis:6.2.6
command: ["/usr/local/bin/redis-server", "/etc/redis/redis.conf"]
ports: #
- 63799:6379
networks:
- back
volumes:
- ./redis/data:/data
- ./redis/redis.conf:/etc/redis/redis.conf
mysql:
restart: always
image: mysql:5.7
ports:
- 3306:3306
networks:
- back
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/logs:/var/log/mysql
- ./mysql/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf
env_file:
- mysql-env.txt
zookeeper:
restart: always
image: zookeeper:3.5
ports:
- 21081:2181
networks:
- back
environment:
ZOO_MY_ID: '1'
ZOO_SERVERS: 'server.1=0.0.0.0:2888:3888;0.0.0.0:2181'
kafka:
restart: always
image: wurstmeister/kafka:2.13-2.7.0
ports:
- 9092:9092
networks:
- back
depends_on:
- zookeeper
env_file:
- kafka-env.txt
gateway:
restart: always
image: gateway-service:20240812102651-0.16-inject
ports:
- 30007:30007
depends_on:
- nacos
networks:
- back
env_file:
- common-env.txt
web:
restart: always
image: web:20240511181522-0.16-inject
depends_on:
- gateway
networks:
- back
volumes:
- ./web/default.conf:/etc/nginx/conf.d/default.conf
business-service:
restart: always
image:businessservice:20240812102651-0.16-inject
ports:
- 40003:40003
- 5216:5216
- 9001:9000
depends_on:
- nacos
- gateway
- mysql
- kafka
- redis
networks:
- back
env_file:
- common-env.txt
volumes:
- ./business-service/data:/home
- ./inject_event/:/home/media
- ./localStorage:/data/localPath
extra_hosts:
- 'inject:host-gateway'
emqx:
restart: always
image: emqx:5.0.21
ports:
- 1883:1883
- 28083:8083
- 8883:8883
- 18084:8084
- 18083:18083
depends_on:
- business-service
networks:
- back
volumes:
- ./emqx/api_key.bootstrap_file:/opt/emqx/etc/api_key.bootstrap_file
- ./emqx/emqx.conf:/opt/emqx/etc/emqx.conf

其中business-service服务启动时候会偶发上述问题。
详细日志:
�[1;32m2024-09-19 09:16:24.523�[0;39m [�[1;33mmain�[0;39m] �[34mINFO �[0;39m �[35mcom.alibaba.nacos.client.config.impl.CacheData�[0;39m - [fixed-nacos_8848-inject_service] [add-listener] ok, tenant=inject_service, dataId=logback.xml, group=DEFAULT_GROUP, cnt=2
�[1;32m2024-09-19 09:16:26.339�[0;39m [�[1;33mmain�[0;39m] �[34mINFO �[0;39m �[35mcom.alibaba.nacos.client.naming�[0;39m - initializer namespace from System Property :null
�[1;32m2024-09-19 09:16:26.340�[0;39m [�[1;33mmain�[0;39m] �[34mINFO �[0;39m �[35mcom.alibaba.nacos.client.naming�[0;39m - initializer namespace from System Environment :null
�[1;32m2024-09-19 09:16:26.342�[0;39m [�[1;33mmain�[0;39m] �[34mINFO �[0;39m �[35mcom.alibaba.nacos.client.naming�[0;39m - initializer namespace from System Property :null
�[1;32m2024-09-19 09:16:26.357�[0;39m [�[1;33mmain�[0;39m] �[1;31mERROR�[0;39m �[35mcom.alibaba.nacos.client.security.SecurityProxy�[0;39m - [SecurityProxy] login http request failed url: http://nacos:8848/nacos/v1/auth/users/login, params: {username=nacos}, bodyMap: {password=nacos}, errorMsg: Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:26.360�[0;39m [�[1;33mcom.alibaba.nacos.client.naming.updater�[0;39m] �[1;31mERROR�[0;39m �[35mcom.alibaba.nacos.client.security.SecurityProxy�[0;39m - [SecurityProxy] login http request failed url: http://nacos:8848/nacos/v1/auth/users/login, params: {username=nacos}, bodyMap: {password=nacos}, errorMsg: Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:26.555�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:26.556�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:26.557�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:26.558�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:26.559�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:26.560�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:26.755�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:26.955�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:27.156�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:27.356�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:27.555�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:27.556�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mcom.alibaba.nacos.client.config.impl.ClientWorker�[0;39m - [fixed-nacos_8848-inject_service] [check-update] get changed dataId exception
java.net.ConnectException: [NACOS HTTP-POST] The maximum number of tolerable server reconnection errors has been reached
at com.alibaba.nacos.client.config.http.ServerHttpAgent.httpPost(ServerHttpAgent.java:181)
at com.alibaba.nacos.client.config.http.MetricsHttpAgent.httpPost(MetricsHttpAgent.java:67)
at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateConfigStr(ClientWorker.java:380)
at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateDataIds(ClientWorker.java:347)
at com.alibaba.nacos.client.config.impl.ClientWorker$LongPollingRunnable.run(ClientWorker.java:535)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
�[1;32m2024-09-19 09:16:27.556�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mcom.alibaba.nacos.client.config.impl.ClientWorker�[0;39m - longPolling error :
java.net.ConnectException: [NACOS HTTP-POST] The maximum number of tolerable server reconnection errors has been reached
at com.alibaba.nacos.client.config.http.ServerHttpAgent.httpPost(ServerHttpAgent.java:181)
at com.alibaba.nacos.client.config.http.MetricsHttpAgent.httpPost(MetricsHttpAgent.java:67)
at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateConfigStr(ClientWorker.java:380)
at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateDataIds(ClientWorker.java:347)
at com.alibaba.nacos.client.config.impl.ClientWorker$LongPollingRunnable.run(ClientWorker.java:535)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
�[1;32m2024-09-19 09:16:29.978�[0;39m [�[1;33mmain�[0;39m] �[1;31mERROR�[0;39m �[35mcom.alibaba.nacos.client.naming�[0;39m - [NA] failed to request
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394)
at java.net.Socket.connect(Socket.java:606)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1226)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:990)
at com.alibaba.nacos.common.http.client.request.JdkHttpClientRequest.execute(JdkHttpClientRequest.java:112)
at com.alibaba.nacos.common.http.client.NacosRestTemplate.execute(NacosRestTemplate.java:482)
at com.alibaba.nacos.common.http.client.NacosRestTemplate.exchangeForm(NacosRestTemplate.java:427)
at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:603)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:526)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:498)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:493)
at com.alibaba.nacos.client.naming.net.NamingProxy.queryList(NamingProxy.java:407)
at com.alibaba.nacos.client.naming.core.HostReactor.updateService(HostReactor.java:382)
at com.alibaba.nacos.client.naming.core.HostReactor.updateServiceNow(HostReactor.java:345)
at com.alibaba.nacos.client.naming.core.HostReactor.getServiceInfo(HostReactor.java:320)
at com.alibaba.nacos.client.naming.core.HostReactor.subscribe(HostReactor.java:139)
at com.alibaba.nacos.client.naming.NacosNamingService.subscribe(NacosNamingService.java:457)
at com.alibaba.cloud.nacos.discovery.NacosWatch.start(NacosWatch.java:133)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
at java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
at com.kunyi.Application.main(Application.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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:65)
�[1;32m2024-09-19 09:16:29.979�[0;39m [�[1;33mmain�[0;39m] �[1;31mERROR�[0;39m �[35mcom.alibaba.nacos.client.naming�[0;39m - [NA] failed to request
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394)
at java.net.Socket.connect(Socket.java:606)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1226)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:990)
at com.alibaba.nacos.common.http.client.request.JdkHttpClientRequest.execute(JdkHttpClientRequest.java:112)
at com.alibaba.nacos.common.http.client.NacosRestTemplate.execute(NacosRestTemplate.java:482)
at com.alibaba.nacos.common.http.client.NacosRestTemplate.exchangeForm(NacosRestTemplate.java:427)
at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:603)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:526)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:498)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:493)
at com.alibaba.nacos.client.naming.net.NamingProxy.queryList(NamingProxy.java:407)
at com.alibaba.nacos.client.naming.core.HostReactor.updateService(HostReactor.java:382)
at com.alibaba.nacos.client.naming.core.HostReactor.updateServiceNow(HostReactor.java:345)
at com.alibaba.nacos.client.naming.core.HostReactor.getServiceInfo(HostReactor.java:320)
at com.alibaba.nacos.client.naming.core.HostReactor.subscribe(HostReactor.java:139)
at com.alibaba.nacos.client.naming.NacosNamingService.subscribe(NacosNamingService.java:457)
at com.alibaba.cloud.nacos.discovery.NacosWatch.start(NacosWatch.java:133)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
at java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
at com.kunyi.Application.main(Application.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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:65)
�[1;32m2024-09-19 09:16:29.980�[0;39m [�[1;33mmain�[0;39m] �[1;31mERROR�[0;39m �[35mcom.alibaba.nacos.client.naming�[0;39m - request: /nacos/v1/ns/instance/list failed, servers: [nacos:8848], code: 500, msg: Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:29.980�[0;39m [�[1;33mmain�[0;39m] �[1;31mERROR�[0;39m �[35mcom.alibaba.nacos.client.naming�[0;39m - [NA] failed to update serviceName: DEFAULT_GROUP@@recycle-manage-service
com.alibaba.nacos.api.exception.NacosException: failed to req API:/nacos/v1/ns/instance/list after all servers([nacos:8848]) tried: java.net.ConnectException: Connection refused (Connection refused)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:556)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:498)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:493)
at com.alibaba.nacos.client.naming.net.NamingProxy.queryList(NamingProxy.java:407)
at com.alibaba.nacos.client.naming.core.HostReactor.updateService(HostReactor.java:382)
at com.alibaba.nacos.client.naming.core.HostReactor.updateServiceNow(HostReactor.java:345)
at com.alibaba.nacos.client.naming.core.HostReactor.getServiceInfo(HostReactor.java:320)
at com.alibaba.nacos.client.naming.core.HostReactor.subscribe(HostReactor.java:139)
at com.alibaba.nacos.client.naming.NacosNamingService.subscribe(NacosNamingService.java:457)
at com.alibaba.cloud.nacos.discovery.NacosWatch.start(NacosWatch.java:133)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
at java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:734)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:308)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
at com.kunyi.Application.main(Application.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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:65)
�[1;32m2024-09-19 09:16:29.986�[0;39m [�[1;33mmain�[0;39m] �[34mINFO �[0;39m �[35mo.s.cloud.stream.binder.DefaultBinderFactory�[0;39m - Creating binder: kafka
�[1;32m2024-09-19 09:16:30.158�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:30.305�[0;39m [�[1;33mmain�[0;39m] �[34mINFO �[0;39m �[35mo.s.cloud.stream.binder.DefaultBinderFactory�[0;39m - Caching the binder: kafka
�[1;32m2024-09-19 09:16:30.314�[0;39m [�[1;33mmain�[0;39m] �[34mINFO �[0;39m �[35mo.s.cloud.stream.binder.DefaultBinderFactory�[0;39m - Retrieving cached binder: kafka
�[1;32m2024-09-19 09:16:30.358�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:30.558�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mc.alibaba.nacos.client.config.http.ServerHttpAgent�[0;39m - [NACOS ConnectException httpPost] currentServerAddr: http://nacos:8848, err : Connection refused (Connection refused)
�[1;32m2024-09-19 09:16:30.559�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mcom.alibaba.nacos.client.config.impl.ClientWorker�[0;39m - [fixed-nacos_8848-inject_service] [check-update] get changed dataId exception
java.net.ConnectException: [NACOS HTTP-POST] The maximum number of tolerable server reconnection errors has been reached
at com.alibaba.nacos.client.config.http.ServerHttpAgent.httpPost(ServerHttpAgent.java:181)
at com.alibaba.nacos.client.config.http.MetricsHttpAgent.httpPost(MetricsHttpAgent.java:67)
at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateConfigStr(ClientWorker.java:380)
at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateDataIds(ClientWorker.java:347)
at com.alibaba.nacos.client.config.impl.ClientWorker$LongPollingRunnable.run(ClientWorker.java:535)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
�[1;32m2024-09-19 09:16:30.559�[0;39m [�[1;33mcom.alibaba.nacos.client.Worker.longPolling.fixed-nacos_8848-inject_service�[0;39m] �[1;31mERROR�[0;39m �[35mcom.alibaba.nacos.client.config.impl.ClientWorker�[0;39m - longPolling error :
java.net.ConnectException: [NACOS HTTP-POST] The maximum number of tolerable server reconnection errors has been reached
at com.alibaba.nacos.client.config.http.ServerHttpAgent.httpPost(ServerHttpAgent.java:181)
at com.alibaba.nacos.client.config.http.MetricsHttpAgent.httpPost(MetricsHttpAgent.java:67)
at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateConfigStr(ClientWorker.java:380)
at com.alibaba.nacos.client.config.impl.ClientWorker.checkUpdateDataIds(ClientWorker.java:347)
at com.alibaba.nacos.client.config.impl.ClientWorker$LongPollingRunnable.run(ClientWorker.java:535)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
�[1;32m2024-09-19 09:16:31.133�[0;39m [�[1;33mcom.alibaba.nacos.client.naming.updater�[0;39m] �[1;31mERROR�[0;39m �[35mcom.alibaba.nacos.client.naming�[0;39m - [NA] failed to request
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:476)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:218)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:200)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:394)
at java.net.Socket.connect(Socket.java:606)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1226)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1162)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1056)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:990)
at com.alibaba.nacos.common.http.client.request.JdkHttpClientRequest.execute(JdkHttpClientRequest.java:112)
at com.alibaba.nacos.common.http.client.NacosRestTemplate.execute(NacosRestTemplate.java:482)
at com.alibaba.nacos.common.http.client.NacosRestTemplate.exchangeForm(NacosRestTemplate.java:427)
at com.alibaba.nacos.client.naming.net.NamingProxy.callServer(NamingProxy.java:603)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:526)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:498)
at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:493)
at com.alibaba.nacos.client.naming.net.NamingProxy.queryList(NamingProxy.java:407)
at com.alibaba.nacos.client.naming.core.HostReactor.updateService(HostReactor.java:382)
at com.alibaba.nacos.client.naming.core.HostReactor$UpdateTask.run(HostReactor.java:464)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

@KomachiSion
Copy link
Collaborator

java.net.ConnectException: Connection refused (Connection refused)

This is the reason which means your configured nacos server address not right, or you do not export nacos port to your client.

@KomachiSion
Copy link
Collaborator

No more response from author for a long time, and this problem seems env problem.

@KomachiSion KomachiSion closed this as not planned Won't fix, can't repro, duplicate, stale Oct 12, 2024
@YS1127
Copy link
Author

YS1127 commented Oct 17, 2024

解决了,是由于docker-compose文件没有进行nacos健康检测,业务服务在nacos服务启动之前启动,导致了业务服务一直连不上nacos导致的(nacos后面启动成功,但是不知道什么原因连接不上),加了健康检测,强制业务服务在nacos服务启动之后再启动就没再出现该问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants