[seata]今天学习搭建seata的时候遇到了一个新问题,困扰了很久,是在是想不到是因为什么了,求帮助

2024-02-04 764 views
1
version seata1.5.2, nacos 2.1.0

我的服务是可以正常启动的,在提交事务的过程中,始终是可以看到xid的,再调用另一个服务的时候,xid也确实传递过去了,可是呢无论我提交什么,在seata的事务表里面始终也没有关于事务的记录。还有就是当我的服务A调用服务B,服务B发生了错误,服务A也不会回滚、看了网上的好多帖子,怎么说的都有一个个尝试,始终没有我想要的答案。还有一点我比较在意。当我的服务启动成功,我觉得应该有register RM success和register TM success的字样,现在只有register RM success出现了,很不理解啊!!! 我的服务A和B的代码

https://gitlab.com/aixiangbaiyun/share/-/blob/main/%E6%9C%8D%E5%8A%A1A%E5%92%8CB.7z

image image service a call service b‘s log image

spring启动log

2023-07-23 22:10:59.131  INFO 20552 --- [  restartedMain] o.f.core.internal.command.DbValidate     : Successfully validated 1 migration (execution time 00:00.159s)
2023-07-23 22:10:59.345  INFO 20552 --- [  restartedMain] o.f.core.internal.command.DbMigrate      : Current version of schema `tool`: 1
2023-07-23 22:10:59.364  INFO 20552 --- [  restartedMain] o.f.core.internal.command.DbMigrate      : Schema `tool` is up to date. No migration necessary.
2023-07-23 22:10:59.578  INFO 20552 --- [  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2023-07-23 22:10:59.629  INFO 20552 --- [  restartedMain] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.6.14.Final
2023-07-23 22:10:59.770  INFO 20552 --- [  restartedMain] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2023-07-23 22:10:59.881  INFO 20552 --- [  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
2023-07-23 22:11:00.439  INFO 20552 --- [  restartedMain] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2023-07-23 22:11:00.450  INFO 20552 --- [  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2023-07-23 22:11:00.809  WARN 20552 --- [  restartedMain] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2023-07-23 22:11:00.847  INFO 20552 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2023-07-23 22:11:00.871  INFO 20552 --- [  restartedMain] o.s.c.openfeign.FeignClientFactoryBean   : For 'tool-service-seata-test' URL not provided. Will try picking an instance via load-balancing.
2023-07-23 22:11:00.929  INFO 20552 --- [  restartedMain] i.s.s.a.GlobalTransactionScanner         : Bean[com.spring.jpa.api.user.UserControllerImpl] with name [userControllerImpl] would use interceptor [io.seata.spring.annotation.GlobalTransactionalInterceptor]
2023-07-23 22:11:03.139  WARN 20552 --- [  restartedMain] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath.
2023-07-23 22:11:03.275  INFO 20552 --- [  restartedMain] com.alibaba.nacos.common.remote.client   : [RpcClientFactory] create a new rpc client of b6366fd1-8158-4588-ab16-96e1235d805e
2023-07-23 22:11:03.275  INFO 20552 --- [  restartedMain] com.alibaba.nacos.common.remote.client   : [b6366fd1-8158-4588-ab16-96e1235d805e] RpcClient init label, labels = {module=naming, source=sdk}
2023-07-23 22:11:03.276  INFO 20552 --- [  restartedMain] com.alibaba.nacos.common.remote.client   : [b6366fd1-8158-4588-ab16-96e1235d805e] RpcClient init, ServerListFactory = com.alibaba.nacos.client.naming.core.ServerListManager
2023-07-23 22:11:03.276  INFO 20552 --- [  restartedMain] com.alibaba.nacos.common.remote.client   : [b6366fd1-8158-4588-ab16-96e1235d805e] Registry connection listener to current client:com.alibaba.nacos.client.naming.remote.gprc.redo.NamingGrpcRedoService
2023-07-23 22:11:03.276  INFO 20552 --- [  restartedMain] com.alibaba.nacos.common.remote.client   : [b6366fd1-8158-4588-ab16-96e1235d805e] Register server push request handler:com.alibaba.nacos.client.naming.remote.gprc.NamingPushRequestHandler
2023-07-23 22:11:03.276  INFO 20552 --- [  restartedMain] com.alibaba.nacos.common.remote.client   : [b6366fd1-8158-4588-ab16-96e1235d805e] Try to connect to server on start up, server: {serverIp = 'localhost', server main port = 8848}
2023-07-23 22:11:03.415  INFO 20552 --- [  restartedMain] com.alibaba.nacos.common.remote.client   : [b6366fd1-8158-4588-ab16-96e1235d805e] Success to connect to server [localhost:8848] on start up, connectionId = 1690121463306_127.0.0.1_59684
2023-07-23 22:11:03.415  INFO 20552 --- [  restartedMain] com.alibaba.nacos.common.remote.client   : [b6366fd1-8158-4588-ab16-96e1235d805e] Register server push request handler:com.alibaba.nacos.common.remote.client.RpcClient$ConnectResetRequestHandler
2023-07-23 22:11:03.415  INFO 20552 --- [  restartedMain] com.alibaba.nacos.common.remote.client   : [b6366fd1-8158-4588-ab16-96e1235d805e] Register server push request handler:com.alibaba.nacos.common.remote.client.RpcClient$$Lambda$353/1649785979
2023-07-23 22:11:03.415  INFO 20552 --- [t.remote.worker] com.alibaba.nacos.common.remote.client   : [b6366fd1-8158-4588-ab16-96e1235d805e] Notify connected event to listeners.
2023-07-23 22:11:03.435  INFO 20552 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path '/tool'
2023-07-23 22:11:03.442  INFO 20552 --- [  restartedMain] c.a.c.n.registry.NacosServiceRegistry    : nacos registry, SEATA_GROUP tool-service 192.168.0.107:8080 register finished
2023-07-23 22:11:03.972  INFO 20552 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8081 (http)
2023-07-23 22:11:03.972  INFO 20552 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2023-07-23 22:11:03.972  INFO 20552 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.70]
2023-07-23 22:11:03.991  INFO 20552 --- [ient-executor-5] com.alibaba.nacos.common.remote.client   : [b6366fd1-8158-4588-ab16-96e1235d805e] Receive server push request, request = NotifySubscriberRequest, requestId = 114
2023-07-23 22:11:03.993  INFO 20552 --- [ient-executor-5] com.alibaba.nacos.common.remote.client   : [b6366fd1-8158-4588-ab16-96e1235d805e] Ack server push request, request = NotifySubscriberRequest, requestId = 114
2023-07-23 22:11:04.053  INFO 20552 --- [  restartedMain] o.a.c.c.C.[Tomcat-1].[localhost].[/]     : Initializing Spring embedded WebApplicationContext
2023-07-23 22:11:04.054  INFO 20552 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 261 ms
2023-07-23 22:11:04.062  INFO 20552 --- [  restartedMain] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 19 endpoint(s) beneath base path '/actuator'
2023-07-23 22:11:04.691  INFO 20552 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8081 (http) with context path ''
2023-07-23 22:11:05.113  INFO 20552 --- [  restartedMain] com.spring.jpa.SpringDataJpaApplication  : Started SpringDataJpaApplication in 16.117 seconds (JVM running for 17.792)
2023-07-23 22:11:05.119  INFO 20552 --- [  restartedMain] c.a.c.n.refresh.NacosContextRefresher    : [Nacos Config] Listening config: dataId=tool-service.properties, group=DEFAULT_GROUP
2023-07-23 22:11:05.121  INFO 20552 --- [  restartedMain] c.a.c.n.refresh.NacosContextRefresher    : [Nacos Config] Listening config: dataId=tool-service, group=DEFAULT_GROUP
2023-07-23 22:11:56.573  INFO 20552 --- [eoutChecker_2_1] i.s.c.r.netty.NettyClientChannelManager  : will connect to 192.168.0.107:8091
2023-07-23 22:11:56.574  INFO 20552 --- [eoutChecker_2_1] i.s.core.rpc.netty.NettyPoolableFactory  : NettyPool create channel to transactionRole:RMROLE,address:192.168.0.107:8091,msg:< RegisterRMRequest{resourceIds='null', applicationId='tool-service', transactionServiceGroup='tool-service-group'} >
2023-07-23 22:11:56.586  INFO 20552 --- [eoutChecker_2_1] i.s.c.rpc.netty.RmNettyRemotingClient    : register RM success. client version:1.5.2, server version:1.5.2,channel:[id: 0xbdcd9e57, L:/192.168.0.107:59739 - R:/192.168.0.107:8091]
2023-07-23 22:11:56.587  INFO 20552 --- [eoutChecker_2_1] i.s.core.rpc.netty.NettyPoolableFactory  : register success, cost 3 ms, version:1.5.2,role:RMROLE,channel:[id: 0xbdcd9e57, L:/192.168.0.107:59739 - R:/192.168.0.107:8091]

springboot version is 2.7.7, my pom is below

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.spring.jpa</groupId>
    <artifactId>spring-data-jpa</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>spring-data-jpa</name>
    <description>spring jpa study</description>

    <properties>
        <java.version>1.8</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <spring-boot.version>2.7.7</spring-boot.version>
        <spring-cloud-openfeign.version>3.1.0</spring-cloud-openfeign.version>
        <spring-cloud-loadbalancer.version>3.1.0</spring-cloud-loadbalancer.version>
        <spring-cloud-nacos.version>2021.0.4.0</spring-cloud-nacos.version>
        <spring-cloud-seata.version>2021.0.4.0</spring-cloud-seata.version>
        <seata.version>1.5.2</seata.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-autoconfigure</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.72</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.7</version>
        </dependency>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-core</artifactId>
        </dependency>
        <!--flyway mysql 必要配置-->
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-mysql</artifactId>
            <version>8.5.4</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-configuration-processor</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <!-- Hutool-->
        <dependency>
            <groupId>cn.hutool</groupId>
            <artifactId>hutool-all</artifactId>
            <version>5.7.18</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>4.1.2</version>
        </dependency>

        <!-- springboot整合swagger -->
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>1.5.12</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.interceptor/javax.interceptor-api -->
        <dependency>
            <groupId>javax.interceptor</groupId>
            <artifactId>javax.interceptor-api</artifactId>
            <version>1.2</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.alibaba.cloud/spring-cloud-starter-alibaba-nacos-discovery -->
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
            <version>${spring-cloud-nacos.version}</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba.cloud</groupId>
            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
            <version>${spring-cloud-nacos.version}</version>
        </dependency>
        <!-- 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>${spring-cloud-seata.version}</version>
        </dependency>
        <dependency>
            <groupId>io.seata</groupId>
            <artifactId>seata-spring-boot-starter</artifactId>
            <version>${seata.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-bootstrap</artifactId>
            <version>3.0.4</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-openfeign</artifactId>
            <version>${spring-cloud-openfeign.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-loadbalancer</artifactId>
            <version>${spring-cloud-loadbalancer.version}</version>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <version>2.7.7</version>
                <configuration>
                    <mainClass>com.spring.jpa.SpringDataJpaApplication</mainClass>
                </configuration>
                <executions>
                    <execution>
                        <id>repackage</id>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                    <addResources>true</addResources>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

seata-service's setting application.yml

server:
  port: 7091

spring:
  application:
    name: seata-server

logging:
  config: classpath:logback-spring.xml
  file:
    path: ${user.home}/logs/seata
  extend:
    logstash-appender:
      destination: 127.0.0.1:4560
    kafka-appender:
      bootstrap-servers: 127.0.0.1:9092
      topic: logback_to_logstash

console:
  user:
    username: seata
    password: seata

seata:
  config:
    # support: nacos, consul, apollo, zk, etcd3
    type: nacos
    nacos:
      server-addr: localhost:8848
      namespace: a0f8d71c-acd6-4703-9423-58671c3ccc0e
      group: SEATA_GROUP
      username: nacos
      password: nacos
      ##if use MSE Nacos with auth, mutex with username/password attribute
      #access-key: ""
      #secret-key: ""
      data-id: seataServer.properties
  registry:
    # support: nacos, eureka, redis, zk, consul, etcd3, sofa
    type: nacos
    nacos:
      application: seata-server
      server-addr: localhost:8848
      group: SEATA_GROUP
      namespace: a0f8d71c-acd6-4703-9423-58671c3ccc0e
      cluster: tool-service-group
      username: nacos
      password: nacos
  security:
    secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
    tokenValidityInMilliseconds: 1800000
    ignore:
      urls: /,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/api/v1/auth/login

seataServer.properties

#For details about configuration items, see https://seata.io/zh-cn/docs/user/configurations.html
#Transport configuration, for client and server
transport.type=TCP
transport.server=NIO
transport.heartbeat=true
transport.enableTmClientBatchSendRequest=false
transport.enableRmClientBatchSendRequest=true
transport.enableTcServerBatchSendResponse=false
transport.rpcRmRequestTimeout=30000
transport.rpcTmRequestTimeout=30000
transport.rpcTcRequestTimeout=30000
transport.threadFactory.bossThreadPrefix=NettyBoss
transport.threadFactory.workerThreadPrefix=NettyServerNIOWorker
transport.threadFactory.serverExecutorThreadPrefix=NettyServerBizHandler
transport.threadFactory.shareBossWorker=false
transport.threadFactory.clientSelectorThreadPrefix=NettyClientSelector
transport.threadFactory.clientSelectorThreadSize=1
transport.threadFactory.clientWorkerThreadPrefix=NettyClientWorkerThread
transport.threadFactory.bossThreadSize=1
transport.threadFactory.workerThreadSize=default
transport.shutdown.wait=3
transport.serialization=seata
transport.compressor=none

#Transaction routing rules configuration, only for the client
service.vgroupMapping.tool-service-group=default
#If you use a registry, you can ignore it
service.default.grouplist=127.0.0.1:8091
service.enableDegrade=false
service.disableGlobalTransaction=false

#Transaction rule configuration, only for the client
client.rm.asyncCommitBufferLimit=10000
client.rm.lock.retryInterval=10
client.rm.lock.retryTimes=30
client.rm.lock.retryPolicyBranchRollbackOnConflict=true
client.rm.reportRetryCount=5
client.rm.tableMetaCheckEnable=true
client.rm.tableMetaCheckerInterval=60000
client.rm.sqlParserType=druid
client.rm.reportSuccessEnable=false
client.rm.sagaBranchRegisterEnable=false
client.rm.sagaJsonParser=fastjson
client.rm.tccActionInterceptorOrder=-2147482648
client.tm.commitRetryCount=5
client.tm.rollbackRetryCount=5
client.tm.defaultGlobalTransactionTimeout=60000
client.tm.degradeCheck=false
client.tm.degradeCheckAllowTimes=10
client.tm.degradeCheckPeriod=2000
client.tm.interceptorOrder=-2147482648
client.undo.dataValidation=true
client.undo.logSerialization=jackson
client.undo.onlyCareUpdateColumns=true
server.undo.logSaveDays=7
server.undo.logDeletePeriod=86400000
client.undo.logTable=undo_log
client.undo.compress.enable=true
client.undo.compress.type=zip
client.undo.compress.threshold=64k
#For TCC transaction mode
tcc.fence.logTableName=tcc_fence_log
tcc.fence.cleanPeriod=1h

#Log rule configuration, for client and server
log.exceptionRate=100

#Transaction storage configuration, only for the server. The file, DB, and redis configuration values are optional.
store.mode=db

#These configurations are required if the `store mode` is `db`. If `store.mode,store.lock.mode,store.session.mode` are not equal to `db`, you can remove the configuration block.
store.db.datasource=druid
store.db.dbType=mysql
store.db.driverClassName=com.mysql.jdbc.Driver
store.db.url=jdbc:mysql://localhost:3307/seata?rewriteBatchedStatements=true
store.db.user=root
store.db.password=123456
store.db.minConn=5
store.db.maxConn=30
store.db.globalTable=global_table
store.db.branchTable=branch_table
store.db.distributedLockTable=distributed_lock
store.db.queryLimit=100
store.db.lockTable=lock_table
store.db.maxWait=5000

#Transaction rule configuration, only for the server
server.recovery.committingRetryPeriod=1000
server.recovery.asynCommittingRetryPeriod=1000
server.recovery.rollbackingRetryPeriod=1000
server.recovery.timeoutRetryPeriod=1000
server.maxCommitRetryTimeout=-1
server.maxRollbackRetryTimeout=-1
server.rollbackRetryTimeoutUnlockEnable=false
server.distributedLockExpireTime=10000
server.xaerNotaRetryTimeout=60000
server.session.branchAsyncQueueSize=5000
server.session.enableBranchAsyncRemove=false
server.enableParallelRequestHandle=false

#Metrics configuration, only for the server
metrics.enabled=false
metrics.registryType=compact
metrics.exporterList=prometheus
metrics.exporterPrometheusPort=9898

回答

8

可以参考以下几个思路去排查: 1、打开Seata日志,查看日志是否有异常信息。 2、查看Seata是否成功注册到Nacos上,注册的IP对不对,注册名对不对。 3、查看Seata的模式是否为DB模式,如果是低版本的Seata默认的数据库驱动是5.7的,假设你用的数据库为8.0需要更换seata的mysql驱动包。 4、代码里是否catch异常没抛出,导致seata无法感知异常。 5、以上均无法定位到问题的话,建议你直接用官方提供的示例代码,文件单机模式跑一遍demo是否正常。

2

你列出的可能性里面,1234都确认过了,或许里面有什么我不懂的地方,也许如果无论如何也不行的话,就只能试试file模式了,并且看看官方给的例子了

4

xid传递如果没有起效果就检查数据源代理,并且确认你的数据源被你所用的orm框架所使用

3

可能我的表述有问题,xid在我的两个微服务中是可以正常传递的,有一张图里面可以看到两个一样的xid,给我的感觉seata控制事务的那部分没有执行。seata的事务表里面一直没有数据

0

我回去再试一下,就目前我所有的配置文件都在这里了,你觉得哪里有问题呢,可以提一下吗?我是真的意识不到。

7

原因找到了吗?

6

试了几次,有人怀疑是代理相关的问题,让我把持久化模式由数据库改成文件,并不好用,没有发现。。。。