王会跳水的鱼
2021-04-22 18:17
采纳率: 100%
浏览 496
已采纳

springcloud seata集成nacos 失败

 

项目环境: nacos+springcloud+mybatis-plus+seatea

前提:本地nacos中已经显示 seata-sever的服务已经注册成功 

相当于服务端的seata已经注册进入到注册中心

 

客户端:

使用的maven 依赖

<!-- seata-->
<dependency>
    <groupId>com.alibaba.cloud</groupId>
    <artifactId>spring-cloud-alibaba-seata</artifactId>
    <version>2.1.0.RELEASE</version>
</dependency>
<dependency>
    <groupId>io.seata</groupId>
    <artifactId>seata-all</artifactId>
    <version>1.1.0</version>
</dependency>

application.pro...中

# Seata 服务组配置
seata.enabled=true
seata.application-id=order-seata-example
seata.tx-service-group=my_test_tx_group
seata.client.rm-report-success-enable=true
seata.client.rm-table-meta-check-enable=false
seata.client.rm-report-retry-count=5
seata.client.rm-async-commit-buffer-limit=10000
seata.client.rm.lock.lock-retry-internal=10
seata.client.rm.lock.lock-retry-times=30
seata.client.rm.lock.lock-retry-policy-branch-rollback-on-conflict=true
seata.client.tm-commit-retry-count=3
seata.client.tm-rollback-retry-count=3
seata.client.undo.undo-data-validation=true
seata.client.undo.undo-log-serialization=jackson
seata.client.undo.undo-log-table=undo_log
seata.client.log.exceptionRate=100
seata.client.support.spring.datasource-autoproxy=true
seata.service.vgroup-mapping.my_test_tx_group=default
seata.service.enable-degrade=false
seata.service.disable-global-transaction=false
seata.service.grouplist.default=127.0.0.1:8091
seata.transport.shutdown.wait=3
seata.transport.thread-factory.boss-thread-prefix=NettyBoss
seata.transport.thread-factory.worker-thread-prefix=NettyServerNIOWorker
seata.transport.thread-factory.server-executor-thread-prefix=NettyServerBizHandler
seata.transport.thread-factory.share-boss-worker=false
seata.transport.thread-factory.client-selector-thread-prefix=NettyClientSelector
seata.transport.thread-factory.client-selector-thread-size=1
seata.transport.thread-factory.client-worker-thread-prefix=NettyClientWorkerThread
seata.transport.type=TCP
seata.transport.server=NIO
seata.transport.heartbeat=true
seata.transport.serialization=seata
seata.transport.compressor=none
seata.transport.enable-client-batch-send-request=true

seata.registry.type=nacos
seata.registry.nacos.server-addr=127.0.0.1:8848
seata.registry.nacos.namespace=
seata.registry.nacos.cluster=default

seata.config.type=nacos
seata.config.nacos.namespace=""
seata.config.nacos.server-addr=127.0.0.1:8848

碰到的问题一:

项目路径中没有register.conf 的时候,直接报错

Caused by: io.seata.common.exception.NotSupportYetException: not support register type: null

通过源码查看

ConfigType configType;
try {
    configTypeName = CURRENT_FILE_INSTANCE.getConfig("config.type");
    configType = ConfigType.getType(configTypeName);
} catch (Exception var8) {
    throw new NotSupportYetException("not support register type: " + configTypeName, var8);
}

必须要项目中 有 register.conf 不清楚 具体原因,不知道是否是 application中 不生效的原因

问题二:

在resources 下面 加入 register.conf ,

registry {
  # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa
  type = "nacos"
  nacos {
    serverAddr = "http://127.0.0.1:8848"
    group = "SEATA_GROUP"
    namespace = ""
    cluster = "default"
    username = "nacos"
    password = "nacos"
  }
}
config {
  # file、nacos 、apollo、zk、consul、etcd3
  type = "nacos"
  nacos {
    serverAddr = "http://127.0.0.1:8848"
    namespace = ""
    group = "SEATA_GROUP"
    username = "nacos"
    password = "nacos"
  }
}

项目回报错

no available service 'null' found, please make sure registry config correct

查看源码,config 为 无Fieds 属性对象

 

问题汇总:为什么application.propites中的 seata配置属性 感觉没有被加载 进入 

只能通过register.conf 中进行 加载,网上其他例子 包括 官网 在客户端 都可以 直接进行配置,不清楚具体原因 希望能解决

 

系统配置:

注册的seata-sever的服务端服务

错误截图:

 

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

4条回答 默认 最新

相关推荐 更多相似问题