seata集成springboot的一些错误小计

1 seata依赖没找到

'dependencies.dependency.version' for com.alibaba.cloud:spring-cloud-starter-alibaba-seata:jar is missing. @ line 126, column 21

错误原因:未指定具体的seata版本
解决

 <!-- https://mvnrepository.com/artifact/com.alibaba.cloud/spring-cloud-starter-alibaba-seata -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-seata</artifactId>
            <version>2021.1</version>
            <exclusions>
                <!--版本较低,1.3.0,因此排除-->
                <exclusion>
                    <artifactId>seata-spring-boot-starter</artifactId>
                    <groupId>io.seata</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- https://mvnrepository.com/artifact/io.seata/seata-spring-boot-starter -->
        <dependency>
            <groupId>io.seata</groupId>
            <artifactId>seata-spring-boot-starter</artifactId>
            <version>1.4.2</version>
        </dependency>

2 applicationId: null, txServiceGroup: null-seata-service-group
错误原因:未指定当前服务名
解决:

spring:
    application:
        name: xxx

3 can not get cluster name in registry config ‘service.vgroupMapping.xxx-seata-service-group‘
错误原因: 事务组配置错误,yml没有和配置文件registry.conf中正确对应
解决:
yml配置

    tx-service-group: seata-demo # 事务组名称
    service:
        vgroup-mapping:
            seata-demo: BJ

conf配置

  nacos {
    application = "seata-server"
    serverAddr = "1.27.0.0.1:8848"
    group = "DEFAULT_GROUP"
    namespace = ""
    cluster = "BJ"
    username = "nacos"
    password = "nacos"
  } 
}

nacos中事务组配置
seata集成springboot的一些错误小计_第1张图片
4 seata报错: 0304 register RM failed.
错误原因:linux部署 启动参数错误 0304代表内网错误 正确的启动参数为:
seata-server.sh -h {ip} -p 8091 不能直接使用seata-server.sh

5 @GlobalTransactional 未生效
1 原因: @GlobalTransactional 是通过 AOP 实现的,只有通过代理调用的方法才会被 AOP 增强。不能使用this
2 多个服务间的调用所有相关服务都必须配置seata

你可能感兴趣的:(spring,boot,后端,java)