Seata异常:endpoint format should like ip:port

Posted 陆陆通通

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Seata异常:endpoint format should like ip:port相关的知识,希望对你有一定的参考价值。

报错信息

Failed to get available servers: endpoint format should like ip:port

java.lang.IllegalArgumentException: endpoint format should like ip:port
	at io.seata.discovery.registry.FileRegistryServiceImpl.lookup(FileRegistryServiceImpl.java:95) ~[seata-all-1.3.0.jar:1.3.0]
	at io.seata.core.rpc.netty.NettyClientChannelManager.getAvailServerList(NettyClientChannelManager.java:217) ~[seata-all-1.3.0.jar:1.3.0]
	at io.seata.core.rpc.netty.NettyClientChannelManager.reconnect(NettyClientChannelManager.java:162) ~[seata-all-1.3.0.jar:1.3.0]
	at io.seata.core.rpc.netty.RmNettyRemotingClient.registerResource(RmNettyRemotingClient.java:181) [seata-all-1.3.0.jar:1.3.0]
	at io.seata.rm.AbstractResourceManager.registerResource(AbstractResourceManager.java:121) [seata-all-1.3.0.jar:1.3.0]
	at io.seata.rm.datasource.DataSourceManager.registerResource(DataSourceManager.java:146) [seata-all-1.3.0.jar:1.3.0]
	at io.seata.rm.DefaultResourceManager.registerResource(DefaultResourceManager.java:114) [seata-all-1.3.0.jar:1.3.0]
	at io.seata.rm.datasource.DataSourceProxy.init(DataSourceProxy.java:99) [seata-all-1.3.0.jar:1.3.0]
	at io.seata.rm.datasource.DataSourceProxy.<init>(DataSourceProxy.java:85) [seata-all-1.3.0.jar:1.3.0]
	at io.seata.rm.datasource.DataSourceProxy.<init>(DataSourceProxy.java:74) [seata-all-1.3.0.jar:1.3.0]
	at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_212]

解决

使用的版本

组件版本
spring-cloud-alibaba2021.1
spring-cloud2020.0.4
Nacos1.4.1
Seata1.3.0

seata客户端的配置和注册中心都使用Nacos的。
在application.yml中的配置

# 配置seata客户端的信息
seata:
  application-id: lutong-service
  tx-service-group: lutong-tx-group
  config:
    type: nacos   # 这里漏写了
    nacos:
      server-addr: 127.0.0.1:8848
      namespace: 1e170347-d013-4d8d-9f32-7afc6d5afd61
      group: SEATA_GROUP
      username: nacos
      password: nacos

seata.config.type配置项漏写了。同时注意需要在Nacos中添加一个配置项:
service.vgroupMapping.lutong-tx-group=default

以上是关于Seata异常:endpoint format should like ip:port的主要内容,如果未能解决你的问题,请参考以下文章

Seata异常:endpoint format should like ip:port

seata的TM端启动异常分析

使用nacos动态刷新数据源导致seata异常

Whats's New In Seata 1.6.x

Spring Boot Endpoints 中的异常处理

springboot + seata + httpclient调用