[seata]Seata-server 1.7 无法读取nacos的配置信息

2024-02-02 243 views
5

Seata-server 1.7.0 nacos 2.2.3 jdk 使用的 1.8

使用从nacos读取配置的方式无法启动报错信息: /Library/Java/JavaVirtualMachines/jdk1.8.0_261.jdk/Contents/Home/bin/java -server -Dloader.path=/Users/liubang/Downloads/seata/ lib -Xmx2048m -Xms2048m -Xss512k -XX:SurvivorRatio=10 -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=256m -XX:MaxDirectMemorySize=1024m -XX:-OmitStackTraceInFastThrow -XX:-UseAdaptiveSizePolicy -XX:+HeapDumpOnOutOfMemoryError -XX :堆转储路径=/Users/liubang/Downloads/seata/logs/java_heapdump.hprof -XX:+DisableExplicitGC -Xloggc:/Users/liubang/Downloads/seata/logs/seata_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+ PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -Dio.netty.leakDetectionLevel=高级 -Dapp.name=seata-server - Dapp.pid=7150 -Dapp.home=/Users/liubang/Downloads/seata -Dbasedir=/Users/liubang/Downloads/seata -Dspring.config.additional-location=/Users/liubang/Downloads/seata/conf/ - dspring.config.location=/Users/liubang/Downloads/seata/conf/application.yml -Dlogging.config=/Users/liubang/Downloads/seata/conf/logback-spring.xml -jar /Users/liubang/Downloads/ Seata/target/seata-server.jar ███████╗███████╗ █████╗ ████████╗ █████╗ ██╔═ ═══╝██╔════╝██╔══██╗╚══██╔══╝██╔══██╗███████╗█████ ╗ ███████║ ██║ ███████║ ╚════██║██╔══╝ ██╔══██║ ██║ ██╔══ ██║ ███████║███████╗██║ ██║ ██║ ██║ ██║╚══════╝╚══════╝ ╚═╝╚═╝╚═╝╚═╝╚═╝

08:58:12.351 INFO --- [ main] [ta.config.ConfigurationFactory] ​​[ load] [] : load Configuration from :Spring Configuration 08:58:12.444 ERROR --- [ main] [amework.boot.SpringApplication] [ reportFailure] [] : 应用程序运行失败 ==> java.lang.ExceptionInInitializerError: null at io.seata.server.spring.listener.SeataPropertiesLoader.initialize(SeataPropertiesLoader.java:76) ~[classes!/:1.7.0]在 org.springframework.boot.SpringApplication.applyInitializers(SpringApplication.java:648) [spring-boot-2.5.13.jar:2.5.13] 在 org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:417) [ spring-boot-2.5.13.jar:2.5.13] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.5.13.jar:2.5.13] 在 org.springframework .boot.SpringApplication.run(SpringApplication.java:1365) [spring-boot-2.5.13.jar:2.5.13] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:1354) [spring-boot- 2.5.13.jar:2.5.13] 在 io.seata.server.ServerApplication.main(ServerApplication.java:31) [classes!/:1.7.0] 在 sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法) ~[ na:1.8.0_261]在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[na:1.8.0_261]在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[na:1.8。 0_261] 在 java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_261] 在 org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [seata-server .jar:1.7.0] 在 org.springframework.boot.loader.Launcher.launch(Launcher.java:108) [seata-server.jar:1.7.0] 在 org.springframework.boot.loader.Launcher.launch( Launcher.java:58) [seata-server.jar:1.7.0] 在 org.springframework.boot.loader.PropertiesLauncher.main(PropertiesLauncher.java:467) [seata-server.jar:1.7.0] 引起: java.lang.RuntimeException:ErrCode:-400,ErrMsg:io.seata.config.nacos.NacosConfiguration 处的端点为空。(NacosConfiguration.java:100) ~[seata-config-nacos-1.7.0.jar:1.7.0] 在 io.seata.config.nacos.NacosConfiguration.getInstance(NacosConfiguration.java:84) ~[seata-config- nacos-1.7.0.jar:1.7.0] 在 io.seata.config.nacos.NacosConfigurationProvider.provide(NacosConfigurationProvider.java:29) ~[seata-config-nacos-1.7.0.jar:1.7.0] 在io.seata.config.ConfigurationFactory.buildConfiguration(ConfigurationFactory.java:160) ~[seata-config-core-1.7.0.jar:1.7.0] 在 io.seata.config.ConfigurationFactory.getInstance(ConfigurationFactory.java:112) ) ~[seata-config-core-1.7.0.jar:1.7.0] 位于 io.seata.server.store.StoreConfig。(StoreConfig.java:33) ~[classes!/:1.7.0] ... 省略了 15 个常见框架 原因:com.alibaba.nacos.api.exception.NacosException:com.alibaba 处的 java.lang.reflect.InitationTargetException .nacos.api.config.ConfigFactory.createConfigService(ConfigFactory.java:46) ~[nacos-api-1.4.2.jar:na] 位于 com.alibaba.nacos.api.NacosFactory.createConfigService(NacosFactory.java:44) ~[nacos-api-1.4.2.jar:na] 位于 io.seata.config.nacos.NacosConfiguration。(NacosConfiguration.java:97) ~[seata-config-nacos-1.7.0.jar:1.7.0] ... 省略了 20 个常见框架 原因:java.lang.reflect.InitationTargetException:sun.reflect.NativeConstructorAccessorImpl 处为 null .newInstance0(本机方法)〜[na:1.8.0_261]在sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)〜[na:1.8.0_261]在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java: 45) ~[na:1.8.0_261] 在 java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_261] 在 com.alibaba.nacos.api.config.ConfigFactory.createConfigService( ConfigFactory.java:43) ~[nacos-api-1.4.2.jar:na] ... 省略 22 个常见帧 原因:com.alibaba.nacos.api.exception.NacosException:com.alibaba 处的端点为空。 nacos.client.config.impl.ServerListManager。(ServerListManager.java:183) ~[nacos-client-1.4.2.jar:na] 位于 com.alibaba.nacos.client.config.http.ServerHttpAgent。(ServerHttpAgent.java:274) ~[nacos-client-1.4.2.jar:na] 位于 com.alibaba.nacos.client.config.NacosConfigService。(NacosConfigService.java:88) ~[nacos-client-1.4.2.jar:na] ... 省略 27 个常见框架 <==

08:58:12.447 WARN --- [ Thread-1] [mmon.http.HttpClientBeanHolder] [ shutdown] [] : [HttpClientBeanHolder] 开始销毁通用 HttpClient 08:58:12.447 WARN --- [ Thread-1] [mmon .http.HttpClientBeanHolder][shutdown][]:[HttpClientBeanHolder]销毁结束

看报错是说初始化失败

Seata 的 yml 配置

服务器:端口:7091

弹簧:应用程序:名称:seata-server

日志记录:配置:classpath:logback-spring.xml 文件:路径:${user.home}/logs/seata 扩展:logstash-appender:目的地:127.0.0.1:4560 kafka-appender:bootstrap-servers:127.0.0.1: 9092主题:logback_to_logstash

控制台: 用户: 用户名: Seata 密码: Seata Seata: 配置:

支持:nacos、consul、apollo、zk、etcd3
type: nacos
nacos:
  service-addr: 127.0.0.1:8848
  namespace: bae31d86-e18b-4a86-9a81-4f31aacf2fb3
  group: SEATA_GROUP
  data-id: seataServer.properties
  username: 
  password: 

注册表:

支持:nacos、eureka、redis、zk、consul、etcd3、sofa
type: nacos
preferred-networks: 30.240.*
nacos:
  application: seata-server
  server-addr: localhost:8848
  group: SEATA_GROUP
  cluster: default
  namespace: 
  username: 
  password: 

店铺:

支持: file 、 db 、 redis
mode: db
db:
  datasource: druid
  db-type: mysql
  driver-class-name: com.mysql.cj.jdbc.Driver
  url: jdbc:mysql://localhost:3306/seata?rewriteBatchedStatements=true
  user: root
  password: xuhuan123
  min-conn: 10
  max-conn: 100
  global-table: global_table
  branch-table: branch_table
  lock-table: lock_table
  distributed-lock-table: distributed_lock
  query-limit: 1000
  max-wait: 5000
server: vgroup-mapping: default-tx-group: fsp_tx_group enable-degrade: false disable-global-transaction: false server: service-port: 8091 #如果不配置,默认为 '${server.port} + 1000'

安全:secretKey:SeataSecretKey0c382ef121d778043159209298fd40bf3850a017 tokenValidityInMilliseconds:1800000忽略:urls:/,/ /*.css,/* / .js,/ /*.html,/ /*.map,/* / .svg,/ /*.png, /*/.jpeg,/*/.ico,/api/v1/auth/login _ _ _ _

nacos中配置文件信息

Transport.type=TCP Transport.server=NIO Transport.heartbeat=truetransport.enableTmClientBatchSendRequest=falsetransport.enableRmClientBatchSendRequest=truetransport.enableTcServerBatchSendResponse=falsetransport.rpcRmRequestTimeout=30000transport.rpcTmRequestTimeout=30000transport.rpcTcRequestTimeout=30000transport.threadFactory.bossThreadPrefix =NettyBosstransport.threadFactory.workerThreadPrefix=NettyServerNIOWorkertransport.threadFactory.serverExecutorThreadPrefix=NettyServerBizHandlertransport.threadFactory.shareBossWorker=falsetransport.threadFactory.clientSelectorThreadPrefix=NettyClientSelectortransport.threadFactory.clientSelectorThreadSize=1transport.threadFactory.clientWorkerThreadPrefix=NettyClientWorkerThreadtransport.threadFactory.bossThread尺寸= 1transport.threadFactory.workerThreadSize=默认transport.shutdown.wait=3transport.serialization=seatatransport.compressor=noneservice.vgroupMapping.default_tx_group=默认service.default.grouplist=127.0.0.1:8091service.enableDegrade=false服务。 disableGlobalTransaction=false 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 tcc.fence.logTableName=tcc_fence_log tcc.fence.cleanPeriod=1h log.exceptionRate=100 store.mode=db store.lock.mode=db store.session.mode= db store.file.dir=file_store/data store.file.maxBranchSessionSize=16384 store.file.maxGlobalSessionSize=512 store.file.fileWriteBufferCacheSize=16384 store.file.flushDiskMode=异步 store.file.sessionReloadReadSize=100 store.db.datasource =druid store.db.dbType=mysql store.db.driverClassName=com.mysql.cj.jdbc.Driver store.db.url=jdbc:mysql://127.0.0.1:3306/seata?useUnicode=true&rewriteBatchedStatements=true 商店.db.user=root store.db.password=xuhuan123 store.db.minConn=5 store.db.maxConn=30 store.db.globalTable=全局表 store.db.branchTable=分支表 store.db.distributedLockTable=分布式锁存储。 db.queryLimit=100 store.db.lockTable=lock_table store.db.maxWait=5000 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。启用BranchAsyncRemove=假server.enableParallelRequestHandle =假metrics.enabled =假metrics.registryType =紧凑metrics.exporterList =普罗米修斯metrics.exporterPrometheusPort = 9898

命名空间 group data-id 都正确 请问是哪里的原因

![上传截屏2023-08-24 09.12.57.png…]()

回答

1

就是文件挂载有问题,读不到nacos地址异常时nacosclient发送的

0

那么怎么调试这个问题啊。。只能file的方式启动了吗?

4

config修改文件的启动方式之后可以注册上nacos不是说明可以访问到但是读取文件有问题?

6

还有就是seata-server怎么终止?直接kill掉进程?

5

可以直接杀掉seata进程。