问题解决:no available service found in cluster ‘default’, please make sure registry config correct and k

java连接seata报错

no available service found in cluster ‘default’, please make sure registry config correct and keep your seata server running

出现这种问题就是因为你的yml配置和seata中conf目录下的register.conf文件内容不一致导致的

pom.xml配置

      <!--seata-->

        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>io.seata</groupId>
                    <artifactId>seata-spring-boot-starter</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>io.seata</groupId>
            <artifactId>seata-spring-boot-starter</artifactId>
            <version>1.4.2</version>
        </dependency>
    </dependencies>

对应的seata版本要对应自己运行的seata版本,我用的是seata-server-1.4.2,所以这里的seata-spring-boot-starter要改为1.4.2 版本的

yml配置

seata:
  enabled: true
  tx-service-group: fengmi_tx_group
  enable-auto-data-source-proxy: false   #开启动态代理
  config:
    type: nacos
    nacos:
      server-addr: 127.0.0.1:8848
      group: DEFAULT_GROUP
      namespace: sit
      username: nacos
      password: nacos
      data-id: fengmi_tx_group-sit.properties
  registry:  # 发现seata-server
    type: nacos
    nacos:
      application: seata-server
      server-addr: 127.0.0.1:8848
      namespace: sit
      group: DEFAULT_GROUP
      username: nacos
      password: nacos
      cluster: default
  service:
    vgroup-mapping:
      fengmi_tx_group: default

这里的配置要和你的seata的conf的文件目录下的register.conf要一致,否则会运行报错的,要仔细检查,像我这样的就是因为一个字母的问题,排查了好久

重点注意上面箭头部分

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值