记一次seata启动错误日志ErrMsg:failed to req API:/nacos/v1/ns/instance after all servers....

错误日志如下:

java.lang.RuntimeException: ErrCode:500, ErrMsg:failed to req API:/nacos/v1/ns/instance after all servers([172.16.176.251:8848]) tried: java.net.SocketException: Connection reset
    at io.seata.core.rpc.netty.NettyServerBootstrap.start(NettyServerBootstrap.java:157) ~[seata-core-1.4.0.jar:na]
    at io.seata.core.rpc.netty.AbstractNettyRemotingServer.init(AbstractNettyRemotingServer.java:55) ~[seata-core-1.4.0.jar:na]
    at io.seata.core.rpc.netty.NettyRemotingServer.init(NettyRemotingServer.java:52) ~[seata-core-1.4.0.jar:na]
    at io.seata.server.Server.main(Server.java:102) ~[classes/:na]
Caused by: com.alibaba.nacos.api.exception.NacosException: failed to req API:/nacos/v1/ns/instance after all servers([172.16.176.251:8848]) tried: java.net.SocketException: Connection reset
    at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:552) ~[nacos-client-1.3.3.jar:na]
    at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:491) ~[nacos-client-1.3.3.jar:na]
    at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:486) ~[nacos-client-1.3.3.jar:na]
    at com.alibaba.nacos.client.naming.net.NamingProxy.registerService(NamingProxy.java:239) ~[nacos-client-1.3.3.jar:na]
    at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:200) ~[nacos-client-1.3.3.jar:na]
    at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:185) ~[nacos-client-1.3.3.jar:na]
    at io.seata.discovery.registry.nacos.NacosRegistryServiceImpl.register(NacosRegistryServiceImpl.java:85) ~[seata-discovery-nacos-1.4.0.jar:na]
    at io.seata.core.rpc.netty.NettyServerBootstrap.start(NettyServerBootstrap.java:153) ~[seata-core-1.4.0.jar:na]
    ... 3 common frames omitted
<==

2021-07-07 09:42:18.097  INFO --- [                          main] io.seata.server.Server                   : The server is running in container.
2021-07-07 09:42:18.125  INFO --- [                          main] io.seata.config.FileConfiguration        : The file name of the operation is file:/root/resources/registry
2021-07-07 09:42:18.127  INFO --- [                          main] io.seata.config.FileConfiguration        : The configuration file used is /root/resources/registry.conf
2021-07-07 09:42:18.310  INFO --- [                          main] io.seata.config.FileConfiguration        : The file name of the operation is file.conf
2021-07-07 09:42:18.311  INFO --- [                          main] io.seata.config.FileConfiguration        : The configuration file used is file.conf
2021-07-07 09:42:18.816  INFO --- [                          main] i.s.core.rpc.netty.NettyServerBootstrap  : Server started, listen port: 8091
2021-07-07 09:42:19.455 ERROR --- [                          main] io.seata.server.Server                   : nettyServer init error:ErrCode:500, ErrMsg:failed to req API:/nacos/v1/ns/instance after all servers([172.16.176.251:8848]) tried: java.net.SocketException: Connection reset
==>
java.lang.RuntimeException: ErrCode:500, ErrMsg:failed to req API:/nacos/v1/ns/instance after all servers([172.16.176.251:8848]) tried: java.net.SocketException: Connection reset
    at io.seata.core.rpc.netty.NettyServerBootstrap.start(NettyServerBootstrap.java:157) ~[seata-core-1.4.0.jar:na]
    at io.seata.core.rpc.netty.AbstractNettyRemotingServer.init(AbstractNettyRemotingServer.java:55) ~[seata-core-1.4.0.jar:na]
    at io.seata.core.rpc.netty.NettyRemotingServer.init(NettyRemotingServer.java:52) ~[seata-core-1.4.0.jar:na]
    at io.seata.server.Server.main(Server.java:102) ~[classes/:na]
Caused by: com.alibaba.nacos.api.exception.NacosException: failed to req API:/nacos/v1/ns/instance after all servers([172.16.176.251:8848]) tried: java.net.SocketException: Connection reset
    at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:552) ~[nacos-client-1.3.3.jar:na]
    at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:491) ~[nacos-client-1.3.3.jar:na]
    at com.alibaba.nacos.client.naming.net.NamingProxy.reqApi(NamingProxy.java:486) ~[nacos-client-1.3.3.jar:na]
    at com.alibaba.nacos.client.naming.net.NamingProxy.registerService(NamingProxy.java:239) ~[nacos-client-1.3.3.jar:na]
    at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:200) ~[nacos-client-1.3.3.jar:na]
    at com.alibaba.nacos.client.naming.NacosNamingService.registerInstance(NacosNamingService.java:185) ~[nacos-client-1.3.3.jar:na]
    at io.seata.discovery.registry.nacos.NacosRegistryServiceImpl.register(NacosRegistryServiceImpl.java:85) ~[seata-discovery-nacos-1.4.0.jar:na]
    at io.seata.core.rpc.netty.NettyServerBootstrap.start(NettyServerBootstrap.java:153) ~[seata-core-1.4.0.jar:na]
    ... 3 common frames omitted
<==

2021-07-07 09:42:23.117  INFO --- [                          main] io.seata.server.Server                   : The server is running in container.
2021-07-07 09:42:23.126  INFO --- [                          main] io.seata.config.FileConfiguration        : The file name of the operation is file:/root/resources/registry
2021-07-07 09:42:23.128  INFO --- [                          main] io.seata.config.FileConfiguration        : The configuration file used is /root/resources/registry.conf
2021-07-07 09:42:23.204  INFO --- [                          main] io.seata.config.FileConfiguration        : The file name of the operation is file.conf
2021-07-07 09:42:23.205  INFO --- [                          main] io.seata.config.FileConfiguration        : The configuration file used is file.conf
2021-07-07 09:42:23.482  INFO --- [                          main] i.s.core.rpc.netty.NettyServerBootstrap  : Server started, listen port: 8091

前提:我用的是NACOS做服务的注册中心,使用docker-compose去启动 nacos,seata; 并且seata依赖nacos启动。也就是说nacos先于seata启动;

启动之后,我查看log,发现打印了上面的错误信息,但是最终启动成功;因为刚开始了解seata,我以为seata虽然启动成功,但是可能存在其他问题。经过查阅,nacos的/nacos/v1/ns/instance接口是用于注册服务实例的;上面显示注册接口无法访问,我刚开始以为是nacos无法访问,后面发现并不是,而且最终启动成功,证明连接上了nacos;去nacos后台查看,发现确实已经存在服务了;那么这个错误肯定就是seata启动的时候,nacos服务并没有完全启动成功,所以接口还无法使用;所以我把nacos和seata的启动时间间隔长一点,发现,果然没有错误日志了;

posted @ 2021-07-07 17:58  房东的Tom  阅读(4265)  评论(1编辑  收藏  举报