Tag Archives: Seata Startup Error

[Solved] Seata Startup Error: ErrMsg:failed to req API:/nacos/v1/ns/instance after all servers….

The error log is as follows:

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

Prerequisite: I use NACOS as the service registry, and use docker-compose to start nacos and seata; and seata relies on nacos to start. That is to say, nacos starts before seata;

After startup, I checked the log and found that the above error message was printed, but the startup was successful; because I just started to understand seata, I thought that although seata started successfully, there might be other problems. After checking, the /nacos/v1/ns/instance interface of nacos is used to register service instances; the above shows that the registration interface is inaccessible. At first I thought it was nacos inaccessible, but later found that it was not, and finally started successfully, proving the connection Go to nacos; check the nacos background and find that there is indeed a service; then this error must be that when seata is started, nacos service has not been started successfully, so the interface is still unavailable; so I set the start time interval of nacos and seata Longer, I found that there is no error log