apache / incubator-seata-samples

Apache Seata(incubating) Samples for Java
https://seata.apache.org/
Apache License 2.0
2.26k stars 1.91k forks source link

@GlobalTransactional无法启动 #352

Open fayou147 opened 4 years ago

fayou147 commented 4 years ago

Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at io.seata.spring.annotation.GlobalTransactionScanner.wrapIfNecessary(GlobalTransactionScanner.java:238) ~[seata-all-1.2.0.jar:1.2.0] at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:299) ~[spring-aop-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:431) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.2.RELEASE.jar:5.2.2.RELEASE] ... 29 common frames omitted Caused by: java.lang.reflect.InvocationTargetException: null at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_202] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_202] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_202] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_202] at io.seata.spring.boot.autoconfigure.provider.SpringBootConfigurationProvider$1.intercept(SpringBootConfigurationProvider.java:84) ~[seata-spring-boot-starter-1.0.0.jar:na] at io.seata.config.FileConfiguration$$EnhancerByCGLIB$$862af1eb.addConfigListener() ~[seata-all-1.2.0.jar:1.2.0] at io.seata.spring.annotation.GlobalTransactionScanner.wrapIfNecessary(GlobalTransactionScanner.java:220) ~[seata-all-1.2.0.jar:1.2.0] ... 33 common frames omitted Caused by: java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String at io.seata.config.FileConfiguration$$EnhancerByCGLIB$$862af1eb.getConfig() ~[seata-all-1.2.0.jar:1.2.0] at io.seata.config.FileConfiguration.addConfigListener(FileConfiguration.java:185) ~[seata-all-1.2.0.jar:1.2.0] ... 40 common frames omitted

错误信息如上,去掉@GlobalTransactional可以正常启动,加上则报错

  1. 已经将config.txt注册到nacos 2.seata server正常启动 3.file.conf已经修改为db

因为我用的是云服务,mysql和nacos都是在docker里面,现在有点不太确定的是,registry.conf里面的serverAddr我是要写公网地址还是内网地址?

附registry.conf: registry {

file 、nacos 、eureka、redis、zk、consul、etcd3、sofa

type = "nacos"

nacos { serverAddr = "121.37.xxx.xx" namespace = "cb588a96-f4b2-493c-8e76-431462d97070" cluster = "default" }

file.conf:

database store property

db {

the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc.

datasource = "druid"
## mysql/oracle/postgresql/h2/oceanbase etc.
dbType = "mysql"
driverClassName = "com.mysql.cj.jdbc.Driver"
url = "jdbc:mysql://121.37.xxx.xx:3306/seata?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true"

config.txt:

transport.type=TCP transport.server=NIO transport.heartbeat=true transport.enableClientBatchSendRequest=false 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 service.vgroupMapping.my_test_tx_group=default service.default.grouplist=127.0.0.1:8091 service.enableDegrade=false service.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=false client.rm.sqlParserType=druid client.rm.reportSuccessEnable=false client.rm.sagaBranchRegisterEnable=false client.tm.commitRetryCount=5 client.tm.rollbackRetryCount=5 client.tm.degradeCheck=false client.tm.degradeCheckAllowTimes=10 client.tm.degradeCheckPeriod=2000 store.mode=file 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 store.db.datasource=druid store.db.dbType=mysql store.db.driverClassName=com.mysql.cj.jdbc.Driver store.db.url=jdbc:mysql://121.37.xxx.xx:3306/seata?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true

121.37.xxx.xx是我的公网地址

zouHero commented 4 years ago

这个问题你解决了吗 我也碰到了一样的问题