开发者社区 > 云原生 > 正文

客户端未连接,当前状态:正在启动

docker环境下,无法连接server,导致获取不到配置,然后应用启动失败。 nacos Server 和 nacos客户端都是2.0.1版本 同一台机器下,部署多个应用,有些应用可以连接,有些不能连接

确认所有的端口都是开放的。

只要我往com.alibaba.nacos.common.remote.client.RpcClient 这个类的start 方法里面打断点,就能连上并启动成功。放开断点,去启动就是以下报错。所以一debug,问题就无法复现

Dec 02 13:59:08 suninfo-omaudit startoma[10734]: 2021-12-02 13:59:08.466 ERROR 10734 --- [ restartedMain] com.alibaba.nacos.common.remote.client : Send request fail, request=ConfigQueryRequest{headers={charset=UTF-8, exConfigInfo=true, Client-AppName=unknown, Client-RequestTS=1638424748277, Client-RequestToken=b06a49491808064535b9f18840d42c50, Timestamp=1638424748280, notify=false}, requestId='null'}, retryTimes=0,errorMessage=Client not connected,current status:STARTING Dec 02 13:59:08 suninfo-omaudit startoma[10734]: 2021-12-02 13:59:08.568 ERROR 10734 --- [ restartedMain] com.alibaba.nacos.common.remote.client : Send request fail, request=ConfigQueryRequest{headers={charset=UTF-8, exConfigInfo=true, Client-AppName=unknown, Client-RequestTS=1638424748277, Client-RequestToken=b06a49491808064535b9f18840d42c50, Timestamp=1638424748280, notify=false}, requestId='null'}, retryTimes=1,errorMessage=Client not connected,current status:STARTING Dec 02 13:59:08 suninfo-omaudit startoma[10734]: 2021-12-02 13:59:08.669 ERROR 10734 --- [ restartedMain] com.alibaba.nacos.common.remote.client : Send request fail, request=ConfigQueryRequest{headers={charset=UTF-8, exConfigInfo=true, Client-AppName=unknown, Client-RequestTS=1638424748277, Client-RequestToken=b06a49491808064535b9f18840d42c50, Timestamp=1638424748280, notify=false}, requestId='null'}, retryTimes=2,errorMessage=Client not connected,current status:STARTING Dec 02 13:59:08 suninfo-omaudit startoma[10734]: 2021-12-02 13:59:08.774 ERROR 10734 --- [ restartedMain] com.alibaba.nacos.common.remote.client : Send request fail, request=ConfigQueryRequest{headers={charset=UTF-8, exConfigInfo=true, Client-AppName=unknown, Client-RequestTS=1638424748673, Client-RequestToken=ef3112bbec87f6743b5ff9da041ebcf0, Timestamp=1638424748673, notify=false}, requestId='null'}, retryTimes=0,errorMessage=Client not connected,current status:STARTING Dec 02 13:59:08 suninfo-omaudit startoma[10734]: 2021-12-02 13:59:08.875 ERROR 10734 --- [ restartedMain] com.alibaba.nacos.common.remote.client : Send request fail, request=ConfigQueryRequest{headers={charset=UTF-8, exConfigInfo=true, Client-AppName=unknown, Client-RequestTS=1638424748673, Client-RequestToken=ef3112bbec87f6743b5ff9da041ebcf0, Timestamp=1638424748673, notify=false}, requestId='null'}, retryTimes=1,errorMessage=Client not connected,current status:STARTING Dec 02 13:59:08 suninfo-omaudit startoma[10734]: 2021-12-02 13:59:08.977 ERROR 10734 --- [ restartedMain] com.alibaba.nacos.common.remote.client : Send request fail, request=ConfigQueryRequest{headers={charset=UTF-8, exConfigInfo=true, Client-AppName=unknown, Client-RequestTS=1638424748673, Client-RequestToken=ef3112bbec87f6743b5ff9da041ebcf0, Timestamp=1638424748673, notify=false}, requestId='null'}, retryTimes=2,errorMessage=Client not connected,current status:STARTING Dec 02 13:59:09 suninfo-omaudit startoma[10734]: 2021-12-02 13:59:09.078 ERROR 10734 --- [ restartedMain] com.alibaba.nacos.common.remote.client : Send request fail, request=ConfigQueryRequest{headers={charset=UTF-8, exConfigInfo=true, Client-AppName=unknown, Client-RequestTS=1638424748978, Client-RequestToken=a3b59fb4e1601aee25edf00c45fa896b, Timestamp=1638424748978, notify=false}, requestId='null'}, retryTimes=0,errorMessage=Client not connected,current status:STARTING Dec 02 13:59:09 suninfo-omaudit startoma[10734]: 2021-12-02 13:59:09.179 ERROR 10734 --- [ restartedMain] com.alibaba.nacos.common.remote.client : Send request fail, request=ConfigQueryRequest{headers={charset=UTF-8, exConfigInfo=true, Client-AppName=unknown, Client-RequestTS=1638424748978, Client-RequestToken=a3b59fb4e1601aee25edf00c45fa896b, Timestamp=1638424748978, notify=false}, requestId='null'}, retryTimes=1,errorMessage=Client not connected,current status:STARTING Dec 02 13:59:09 suninfo-omaudit startoma[10734]: 2021-12-02 13:59:09.279 ERROR 10734 --- [ restartedMain] com.alibaba.nacos.common.remote.client : Send request fail, request=ConfigQueryRequest{headers={charset=UTF-8, exConfigInfo=true, Client-AppName=unknown, Client-RequestTS=1638424748978, Client-RequestToken=a3b59fb4e1601aee25edf00c45fa896b, Timestamp=1638424748978, notify=false}, requestId='null'}, retryTimes=2,errorMessage=Client not connected,current status:STARTING Dec 02 13:59:23 suninfo-omaudit startoma[10734]: 2021-12-02 13:59:23.089 ERROR 10734 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed

原提问者GitHub用户alfredodiego

展开
收起
学习娃 2023-05-22 16:09:29 204 0
1 条回答
写回答
取消 提交回答
  • 我猜测是连接server响应比较慢, 实际连接操作是异步的,如果连接还没建立好就请求,会报错,然后程序就退出了。

    打断点的时候因为断点延长的启动时间,所以连接上了,后续请求就都正常了。 我的环境都没有复现出这个问题。 可以试着升级一下服务端和客户端的版本,并且在启动后实际调用nacos的地方sleep1s试试看。

    原回答者GitHub用户KomachiSion

    2023-05-23 09:32:49
    赞同 展开评论 打赏
问答分类:
问答地址:

阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载