jmbkeyes opened a new issue #9445:
URL: https://github.com/apache/shardingsphere/issues/9445
## Question
When I try to config springboot app with sharding-jdbc and seata, but the
app can't start up.
Related compontents:
springboot:2.4.2
seata-server:1.4.1(config type is file)
shardingsphere-jdbc:4.1.1
project dependcies:
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation
'org.apache.shardingsphere:sharding-jdbc-spring-boot-starter:4.1.1'
implementation
'org.apache.shardingsphere:sharding-transaction-base-seata-at:4.1.1'
implementation 'io.seata:seata-all:1.4.1'
runtimeOnly 'mysql:mysql-connector-java:5.1.30'
and exception as below.
Error starting ApplicationContext. To display the conditions report re-run
your application with 'debug' enabled.
2021-02-20 09:19:02.659 ERROR 21016 --- [ main]
o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name
'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration':
Unsatisfied dependency expressed through constructor parameter 0; nested
exception is org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'shardingDataSource' defined in class path resource
[org/apache/shardingsphere/shardingjdbc/spring/boot/SpringBootConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate
[javax.sql.DataSource]: Factory method 'shardingDataSource' threw exception;
nested exception is java.lang.ExceptionInInitializerError
at
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1356)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1206)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:410)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1179)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1159)
~[spring-context-5.3.3.jar:5.3.3]
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
~[spring-context-5.3.3.jar:5.3.3]
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:588)
~[spring-context-5.3.3.jar:5.3.3]
at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
~[spring-boot-2.4.2.jar:2.4.2]
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767)
[spring-boot-2.4.2.jar:2.4.2]
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
[spring-boot-2.4.2.jar:2.4.2]
at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)
[spring-boot-2.4.2.jar:2.4.2]
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:326)
[spring-boot-2.4.2.jar:2.4.2]
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1311)
[spring-boot-2.4.2.jar:2.4.2]
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1300)
[spring-boot-2.4.2.jar:2.4.2]
at com.forzadata.bodytrack.Application.main(Application.java:12)
[main/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'shardingDataSource' defined in class path resource
[org/apache/shardingsphere/shardingjdbc/spring/boot/SpringBootConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate
[javax.sql.DataSource]: Factory method 'shardingDataSource' threw exception;
nested exception is java.lang.ExceptionInInitializerError
at
org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1179)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:571)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
~[spring-beans-5.3.3.jar:5.3.3]
... 29 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to
instantiate [javax.sql.DataSource]: Factory method 'shardingDataSource' threw
exception; nested exception is java.lang.ExceptionInInitializerError
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
~[spring-beans-5.3.3.jar:5.3.3]
at
org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
~[spring-beans-5.3.3.jar:5.3.3]
... 43 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: null
at
io.seata.core.rpc.netty.TmNettyRemotingClient.getInstance(TmNettyRemotingClient.java:114)
~[seata-all-1.4.1.jar:1.4.1]
at
io.seata.core.rpc.netty.TmNettyRemotingClient.getInstance(TmNettyRemotingClient.java:97)
~[seata-all-1.4.1.jar:1.4.1]
at io.seata.tm.TMClient.init(TMClient.java:46)
~[seata-all-1.4.1.jar:1.4.1]
at io.seata.tm.TMClient.init(TMClient.java:34)
~[seata-all-1.4.1.jar:1.4.1]
at
org.apache.shardingsphere.transaction.base.seata.at.SeataATShardingTransactionManager.initSeataRPCClient(SeataATShardingTransactionManager.java:75)
~[sharding-transaction-base-seata-at-4.1.1.jar:4.1.1]
at
org.apache.shardingsphere.transaction.base.seata.at.SeataATShardingTransactionManager.init(SeataATShardingTransactionManager.java:66)
~[sharding-transaction-base-seata-at-4.1.1.jar:4.1.1]
at
org.apache.shardingsphere.transaction.ShardingTransactionManagerEngine.init(ShardingTransactionManagerEngine.java:67)
~[sharding-transaction-core-4.1.1.jar:4.1.1]
at
org.apache.shardingsphere.shardingjdbc.jdbc.core.context.ShardingRuntimeContext.<init>(ShardingRuntimeContext.java:52)
~[sharding-jdbc-core-4.1.1.jar:4.1.1]
at
org.apache.shardingsphere.shardingjdbc.jdbc.core.datasource.ShardingDataSource.<init>(ShardingDataSource.java:54)
~[sharding-jdbc-core-4.1.1.jar:4.1.1]
at
org.apache.shardingsphere.shardingjdbc.api.ShardingDataSourceFactory.createDataSource(ShardingDataSourceFactory.java:48)
~[sharding-jdbc-core-4.1.1.jar:4.1.1]
at
org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration.shardingDataSource(SpringBootConfiguration.java:103)
~[sharding-jdbc-spring-boot-starter-4.1.1.jar:4.1.1]
at
org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration$$EnhancerBySpringCGLIB$$d6a321ab.CGLIB$shardingDataSource$3(<generated>)
~[sharding-jdbc-spring-boot-starter-4.1.1.jar:4.1.1]
at
org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration$$EnhancerBySpringCGLIB$$d6a321ab$$FastClassBySpringCGLIB$$43309a9.invoke(<generated>)
~[sharding-jdbc-spring-boot-starter-4.1.1.jar:4.1.1]
at
org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
~[spring-core-5.3.3.jar:5.3.3]
at
org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
~[spring-context-5.3.3.jar:5.3.3]
at
org.apache.shardingsphere.shardingjdbc.spring.boot.SpringBootConfiguration$$EnhancerBySpringCGLIB$$d6a321ab.shardingDataSource(<generated>)
~[sharding-jdbc-spring-boot-starter-4.1.1.jar:4.1.1]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
~[na:1.8.0_171]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[na:1.8.0_171]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.8.0_171]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_171]
at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
~[spring-beans-5.3.3.jar:5.3.3]
... 44 common frames omitted
Caused by: io.seata.common.exception.NotSupportYetException: config type can
not be null
at
io.seata.config.ConfigurationFactory.buildConfiguration(ConfigurationFactory.java:110)
~[seata-all-1.4.1.jar:1.4.1]
at
io.seata.config.ConfigurationFactory.getInstance(ConfigurationFactory.java:94)
~[seata-all-1.4.1.jar:1.4.1]
at
io.seata.core.rpc.netty.NettyBaseConfig.<clinit>(NettyBaseConfig.java:54)
~[seata-all-1.4.1.jar:1.4.1]
... 65 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:58839', transport:
'socket'
Process finished with exit code 1
**For English only**, other languages will not accept.
Before asking a question, make sure you have:
- Googled your question.
- Searched open and closed [GitHub
issues](https://github.com/apache/shardingsphere/issues).
- Read documentation: [ShardingSphere
Doc](https://shardingsphere.apache.org/document/current/en/overview).
Please pay attention on issues you submitted, because we maybe need more
details.
If no response anymore and we cannot reproduce it on current information, we
will **close it**.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]