hanpijun-buhanpi opened a new issue, #7056:
URL: https://github.com/apache/incubator-seata/issues/7056

   <!-- Please do not use this issue template to report security 
vulnerabilities but refer to our [security 
policy](https://github.com/seata/seata/security/policy). -->
   
   - [x] I have searched the [issues](https://github.com/seata/seata/issues) of 
this repository and believe that this is not a duplicate.
   
   ### Ⅰ. Issue Description
   Nacos根据data-id获取不到配置文件
   
   ### Ⅱ. Describe what happened
   
   在服务器端配置了seata.config.nacos.data-id=seata-server.properties时,它似乎是正常的,至少没有异常报错。
   但在客户端配置了seata.config.nacos.data-id=seata-server.properties后,它发生了如下错误
   
     If there is an exception, please attach the exception trace:
   
   ```
   org.apache.seata.config.exception.ConfigNotFoundException: 
service.vgroupMapping.default_tx_group configuration item is required
        at 
org.apache.seata.discovery.registry.nacos.NacosRegistryServiceImpl.lookup(NacosRegistryServiceImpl.java:153)
 ~[seata-all-2.2.0.jar:2.2.0]
        at 
org.apache.seata.core.rpc.netty.NettyClientChannelManager.getAvailServerList(NettyClientChannelManager.java:299)
 [seata-all-2.2.0.jar:2.2.0]
        at 
org.apache.seata.core.rpc.netty.NettyClientChannelManager.doReconnect(NettyClientChannelManager.java:187)
 [seata-all-2.2.0.jar:2.2.0]
        at 
org.apache.seata.core.rpc.netty.NettyClientChannelManager.initReconnect(NettyClientChannelManager.java:176)
 [seata-all-2.2.0.jar:2.2.0]
        at 
org.apache.seata.core.rpc.netty.TmNettyRemotingClient.initConnection(TmNettyRemotingClient.java:291)
 [seata-all-2.2.0.jar:2.2.0]
        at 
org.apache.seata.core.rpc.netty.TmNettyRemotingClient.init(TmNettyRemotingClient.java:191)
 [seata-all-2.2.0.jar:2.2.0]
        at org.apache.seata.tm.TMClient.init(TMClient.java:47) 
[seata-all-2.2.0.jar:2.2.0]
        at 
org.apache.seata.spring.annotation.GlobalTransactionScanner.initClient(GlobalTransactionScanner.java:247)
 [seata-all-2.2.0.jar:2.2.0]
        at 
org.apache.seata.spring.annotation.GlobalTransactionScanner.afterPropertiesSet(GlobalTransactionScanner.java:495)
 [seata-all-2.2.0.jar:2.2.0]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863)
 [spring-beans-5.3.31.jar:5.3.31]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800)
 [spring-beans-5.3.31.jar:5.3.31]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:620)
 [spring-beans-5.3.31.jar:5.3.31]
        at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
 [spring-beans-5.3.31.jar:5.3.31]
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
 [spring-beans-5.3.31.jar:5.3.31]
        at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
 ~[spring-beans-5.3.31.jar:5.3.31]
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
 [spring-beans-5.3.31.jar:5.3.31]
        at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213)
 [spring-beans-5.3.31.jar:5.3.31]
        at 
org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:258)
 ~[spring-context-5.3.31.jar:5.3.31]
        at 
org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:773)
 ~[spring-context-5.3.31.jar:5.3.31]
        at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:575)
 ~[spring-context-5.3.31.jar:5.3.31]
        at 
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
 ~[spring-boot-2.7.18.jar:2.7.18]
        at 
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) 
~[spring-boot-2.7.18.jar:2.7.18]
        at 
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:409)
 ~[spring-boot-2.7.18.jar:2.7.18]
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:308) 
~[spring-boot-2.7.18.jar:2.7.18]
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) 
~[spring-boot-2.7.18.jar:2.7.18]
        at 
org.springframework.boot.SpringApplication.run(SpringApplication.java:1289) 
~[spring-boot-2.7.18.jar:2.7.18]
        at com.example.business.SeataAtBusiness.main(SeataAtBusiness.java:19) 
~[classes/:na]
   ```
   
   
   ### Ⅲ. Describe what you expected to happen
   
   
   ### Ⅳ. How to reproduce it (as minimally and precisely as possible)
   
   1. 服务器端配置
   ```yaml
   server:
     port: 7091
   
   spring:
     application:
       name: seata-server
   
   logging:
     config: classpath:logback-spring.xml
     file:
       path: ${log.home:${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:
       type: nacos
       nacos:
         server-addr: 127.0.0.1:8848
   #      namespace: 
         group: SEATA_GROUP
         context-path:
         ##1.The following configuration is for the open source version of Nacos
         username: nacos
         password: nacos
         ##2.The following configuration is for the MSE Nacos on aliyun
         #access-key:
         #secret-key:
         ##3.The following configuration is used to deploy on Aliyun ECS or ACK 
without authentication
         #ram-role-name:
         data-id: seata-server.properties
     registry:
       type: nacos
       metadata:
         weight: 100
       seata:
         server-addr: 127.0.0.1:8081
         cluster: default
         namespace: public
         heartbeat-period: 5000
       nacos:
         application: seata-server
         server-addr: 127.0.0.1:8848
         group: SEATA_GROUP
   #      namespace: 
         cluster: default
         context-path:
         ##1.The following configuration is for the open source version of Nacos
         username: nacos
         password: nacos
         ##2.The following configuration is for the MSE Nacos on aliyun
         #access-key:
         #secret-key:
         ##3.The following configuration is used to deploy on Aliyun ECS or ACK 
without authentication
         #ram-role-name:
   
     server:
       service-port: 8091
       max-commit-retry-timeout: -1
       max-rollback-retry-timeout: -1
       rollback-retry-timeout-unlock-enable: false
       enable-check-auth: true
       enable-parallel-request-handle: true
       enable-parallel-handle-branch: false
       retry-dead-threshold: 130000
       xaer-nota-retry-timeout: 60000
       enableParallelRequestHandle: true
       applicationDataLimitCheck: true
       applicationDataLimit: 64000
       recovery:
         committing-retry-period: 1000
         async-committing-retry-period: 1000
         rollbacking-retry-period: 1000
         timeout-retry-period: 1000
       undo:
         log-save-days: 7
         log-delete-period: 86400000
       session:
         branch-async-queue-size: 5000 #branch async remove queue size
         enable-branch-async-remove: false #enable to asynchronous remove 
branchSession
     store:
       # 支持: file、db、redis、raft(使用raft时,registry必须为seata或file)
       mode: file
       session:
         mode: file
       lock:
         mode: file
       file:
         dir: sessionStore
         max-branch-session-size: 16384
         max-global-session-size: 512
         file-write-buffer-cache-size: 16384
         session-reload-read-size: 100
         flush-disk-mode: async
     metrics:
       enabled: false
       registry-type: compact
       exporter-list: prometheus
       exporter-prometheus-port: 9898
     transport:
       rpc-tc-request-timeout: 15000
       enable-tc-server-batch-send-response: false
       shutdown:
         wait: 3
       thread-factory:
         boss-thread-prefix: NettyBoss
         worker-thread-prefix: NettyServerNIOWorker
         boss-thread-size: 1
     security:
       secretKey: SeataSecretKey0c382ef121d778043159209298fd40bf3850a017
       tokenValidityInMilliseconds: 1800000
       csrf-ignore-urls: /metadata/v1/**
       ignore:
         urls: 
/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.jpeg,/**/*.ico,/api/v1/auth/login,/version.json,/health,/error
   ```
   
   2. Nacos配置
   
![image](https://github.com/user-attachments/assets/4a834259-d431-46dc-b18e-acdfd10208ed)
   ```properties
   #For details about configuration items, see 
https://seata.apache.org/zh-cn/docs/user/configurations
   #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.default_tx_group=default
   #If you use a registry, you can ignore it
   service.default.grouplist=127.0.0.1:8091
   service.disableGlobalTransaction=false
   
   client.metadataMaxAgeMs=30000
   #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.rm.sqlParserType=druid
   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
   # You can choose from the following options: fastjson, jackson, gson
   tcc.contextJsonParserType=fastjson
   
   #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=file
   store.lock.mode=file
   store.session.mode=file
   #Used for password encryption
   store.publicKey=
   
   #If `store.mode,store.lock.mode,store.session.mode` are not equal to `file`, 
you can remove the configuration block.
   store.file.dir=file_store/data
   store.file.maxBranchSessionSize=16384
   store.file.maxGlobalSessionSize=512
   store.file.fileWriteBufferCacheSize=16384
   store.file.flushDiskMode=async
   store.file.sessionReloadReadSize=100
   
   #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.session.branchAsyncQueueSize=5000
   server.session.enableBranchAsyncRemove=false
   server.enableParallelRequestHandle=true
   server.enableParallelHandleBranch=false
   server.applicationDataLimit=64000
   server.applicationDataLimitCheck=false
   
   server.raft.server-addr=127.0.0.1:7091,127.0.0.1:7092,127.0.0.1:7093
   server.raft.snapshotInterval=600
   server.raft.applyBatch=32
   server.raft.maxAppendBufferSize=262144
   server.raft.maxReplicatorInflightMsgs=256
   server.raft.disruptorBufferSize=16384
   server.raft.electionTimeoutMs=2000
   server.raft.reporterEnabled=false
   server.raft.reporterInitialDelay=60
   server.raft.serialization=jackson
   server.raft.compressor=none
   server.raft.sync=true
   
   #Metrics configuration, only for the server
   metrics.enabled=true
   metrics.registryType=compact
   metrics.exporterList=prometheus
   metrics.exporterPrometheusPort=9898
   ```
   
   3. 服务器端注册成功
   
![image](https://github.com/user-attachments/assets/c79b0855-e326-4bf9-afcc-1a0a31087a8f)
   
   4. 客户端配置
   ```properties
   server.port=${business.port:8083}
   spring.application.name=seata-at-business
   spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
   
spring.datasource.url=jdbc:mysql://${mysql.address:127.0.0.1}:3306/seata?useSSL=false&useUnicode=true&characterEncoding=UTF-8
   spring.datasource.username=${mysql.user:root}
   spring.datasource.password=${mysql.password:123456}
   seata.enabled=true
   seata.application-id=${spring.application.name}
   seata.tx-service-group=default_tx_group
   seata.service.vgroup-mapping.default_tx_group=default
   seata.service.grouplist.default=${seata.address:127.0.0.1:8091}
   seata.registry.type=nacos
   seata.registry.nacos.server-addr=127.0.0.1:8848
   seata.registry.nacos.group=SEATA_GROUP
   #seata.registry.nacos.namespace=
   seata.registry.nacos.username=nacos
   seata.registry.nacos.password=nacos
   seata.config.type=nacos
   seata.config.nacos.server-addr=127.0.0.1:8848
   seata.config.nacos.group=SEATA_GROUP
   #seata.config.nacos.namespace=
   seata.config.nacos.data-id=seata-server.properties
   seata.config.nacos.username=nacos
   seata.config.nacos.password=nacos
   ```
   
   5. 客户端debug调试
   查看当前data-id
   
![image](https://github.com/user-attachments/assets/78a4b9d3-cb01-4992-a169-ca492f03d74f)
   查看当前group
   
![image](https://github.com/user-attachments/assets/ea04a075-0ba1-4f9b-aac0-ccb11722034f)
   获取nacos配置
   
![image](https://github.com/user-attachments/assets/e75c6792-df7e-4ed0-84ff-efbf1c13258e)
   但是,如果只用'seata-server'获取的话就能获取到
   
![image](https://github.com/user-attachments/assets/da407e5a-597d-4270-8c7d-e0aa5ede36a9)
   
   
   Minimal yet complete reproducer code (or URL to code):
   
   
   
   ### Ⅴ. Anything else we need to know?
   
   
   ### Ⅵ. Environment:
   
   - JDK version(e.g. `java -version`):1.8.0_351
   - Seata client/server version:  2.2
   - Database version:MySQL 8.0.39
   - OS(e.g. `uname -a`):Windows 11 专业版 23H2 22631.4460
   - Others:


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to