io.seata.common.exception.FrameworkException: No available service

学习seata,配置了从nacos读取配置

配置结构

resources配置

nacos配置对应的service.vgroupMapping

nacos配置

registry.conf

registry {
  # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
  type = "nacos"

  nacos {
    application = "seata-server"
    serverAddr = "localhost:8848"
    namespace = ""
    username = ""
    password = ""
  }
  file {
    name = "file.conf"
  }
}

config {
  # file、nacos 、apollo、zk、consul、etcd3、springCloudConfig
  type = "nacos"

  nacos {
    serverAddr = "localhost:8848"
    namespace = ""
    group = "SEATA_GROUP"
    username = ""
    password = ""
  }
  file {
    name = "file.conf"
  }
}

seata.conf

这个配置很重要,标识当前应用分布式事务

client {
    application.id = health-base
    transaction.service.group = health-base-group
}

启动项目,报错:

Exception in thread "main" io.seata.common.exception.FrameworkException: No available service
    at io.seata.core.rpc.netty.AbstractRpcRemotingClient.loadBalance(AbstractRpcRemotingClient.java:194)
    at io.seata.core.rpc.netty.AbstractRpcRemotingClient.sendMsgWithResponse(AbstractRpcRemotingClient.java:140)
    at io.seata.core.rpc.netty.AbstractRpcRemotingClient.sendMsgWithResponse(AbstractRpcRemotingClient.java:148)
    at io.seata.tm.DefaultTransactionManager.syncCall(DefaultTransactionManager.java:95)
    at io.seata.tm.DefaultTransactionManager.begin(DefaultTransactionManager.java:53)
    at io.seata.tm.api.DefaultGlobalTransaction.begin(DefaultGlobalTransaction.java:105)
    at io.seata.tm.api.DefaultGlobalTransaction.begin(DefaultGlobalTransaction.java:87)
    at io.seata.tm.api.DefaultGlobalTransaction.begin(DefaultGlobalTransaction.java:82)

经过检查,配置都正确,发现我的seata-server版本是1.2.0的,但是seata-all的版本为1.1.0

        
            io.seata
            seata-all
            1.1.0
        

修改为对应的版本即可(或者更高的版本,我修改的是1.3.0)

        
            io.seata
            seata-all
            1.2.0
        

后记

使用seata,还是要弄清楚各项配置的作用,包括服务端的配置,客户端的配置,数据从nacos读取或者从其他服务端读取,是一个什么样的方式.

你可能感兴趣的:(io.seata.common.exception.FrameworkException: No available service)