suikenungleung opened a new issue #8588:
URL: https://github.com/apache/shardingsphere/issues/8588
version:
- Spring Boot 2.3.6,
- Spring Cloud Hoxton.SR9
- Spring Cloud Alibaba 2.2.3.RELEASE
- ShardingSphere-JDBC 5.0.0-alpha
- Spring Cloud Alibaba Seata 2.2.0.RELEASE
seata.conf
```
client {
application.id = account-service
transaction.service.group = account-service-group
}
```
registry.conf
```
registry {
# file 、nacos 、eureka、redis、zk
type = "nacos"
nacos {
application = "seata-server"
serverAddr =
"192.168.177.135:8848,192.168.177.135:8849,192.168.177.135:8850"
group = "SEATA_GROUP"
namespace = "fd84373c-fd56-41b6-8906-c972e462d529"
cluster = "default"
username = "nacos"
password = "yY1C9Qh3bs8a72"
}
}
config {
# file、nacos 、apollo、zk
type = "nacos"
nacos {
serverAddr =
"192.168.177.135:8848,192.168.177.135:8849,192.168.177.135:8850"
namespace = "fd84373c-fd56-41b6-8906-c972e462d529"
group = "SEATA_GROUP"
username = "nacos"
password = "yY1C9Qh3bs8a72"
}
}
```
application.yml
```
server:
port: 8080
spring:
application:
name: account-service
shardingsphere:
datasource:
common:
driver-class-name: com.mysql.cj.jdbc.Driver
password: 123456
type: com.zaxxer.hikari.HikariDataSource
username: root
ds-p0:
jdbc-url:
jdbc:mysql://192.168.177.135:3306/seata_amount?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
ds-p0-r0:
jdbc-url:
jdbc:mysql://192.168.177.135:3307/seata_amount?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
ds-p0-r1:
jdbc-url:
jdbc:mysql://192.168.177.135:3308/seata_amount?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=UTF-8
names: ds-p0,ds-p0-r0,ds-p0-r1 # ,ds-p1,ds-p1-r0,ds-p1-r1
props:
sql-show: true
rules:
replica-query:
data-sources:
ds-0:
load-balancer-name: robin-0
primary-data-source-name: ds-p0
replica-data-source-names: ds-p0-r0,ds-p0-r1
load-balancers:
robin-0:
props:
sql-show: true
type: ROUND_ROBIN
sharding:
binding-tables: account
default-database-strategy:
standard:
sharding-algorithm-name: database-inline
sharding-column: id
key-generators:
snowflake:
props:
worker-id: 123
type: SNOWFLAKE
sharding-algorithms:
account-inline:
props:
algorithm-expression: account_$->{id % 3}
type: INLINE
tables:
account:
# actual-data-nodes: ds-$->{0..1}.account_$->{0..2}
actual-data-nodes: ds-p0.account_$->{0..2}
key-generate-strategy:
column: id
key-generator-name: snowflake
table-strategy:
standard:
sharding-algorithm-name: account-inline
sharding-column: id
mybatis:
config-location: classpath:mybatis/mybatis-config.xml
seata:
application-id: ${spring.application.name}
tx-service-group: ${spring.application.name}-group
service:
vgroup-mapping:
order-service-group: default
disable-global-transaction: false
registry:
type: nacos
nacos:
application: seata-server
serverAddr:
192.168.177.135:8848,192.168.177.135:8849,192.168.177.135:8850
group: SEATA_GROUP
namespace: fd84373c-fd56-41b6-8906-c972e462d529
cluster: default
username: nacos
password: yY1C9Qh3bs8a72
```
Seata uses Nacos storage, combined with ShardingSphere-JDBC how to configure.
Error now:
```
2020-12-12 01:19:59.646 INFO 2228 --- [ main]
o.a.s.i.c.schema.SchemaContextsBuilder : Load meta data for schema logic_db
finished, cost 178 milliseconds.
2020-12-12 01:19:59.652 INFO 2228 --- [ main]
io.seata.config.FileConfiguration : The configuration file used is
seata.conf
2020-12-12 01:20:00.166 ERROR 2228 --- [ main]
i.s.c.r.netty.NettyClientChannelManager : no available service 'null' found,
please make sure registry config correct
2020-12-12 01:20:00.169 ERROR 2228 --- [ main]
i.s.c.r.netty.NettyClientChannelManager : no available service 'null' found,
please make sure registry config correct
2020-12-12 01:20:00.172 ERROR 2228 --- [ main]
i.s.c.r.netty.NettyClientChannelManager : no available service 'null' found,
please make sure registry config correct
2020-12-12 01:20:00.196 INFO 2228 --- [ main]
.s.s.a.d.SeataAutoDataSourceProxyCreator : Auto proxy of
[shardingSphereDataSource]
2020-12-12 01:20:00.203 INFO 2228 --- [ main]
o.s.aop.framework.CglibAopProxy : Unable to proxy
interface-implementing method [public final int
org.apache.shardingsphere.driver.jdbc.unsupported.AbstractUnsupportedOperationDataSource.getLoginTimeout()
throws java.sql.SQLException] because it is marked as final: Consider using
interface-based JDK proxies instead!
2020-12-12 01:20:00.203 INFO 2228 --- [ main]
o.s.aop.framework.CglibAopProxy : Unable to proxy
interface-implementing method [public final void
org.apache.shardingsphere.driver.jdbc.unsupported.AbstractUnsupportedOperationDataSource.setLoginTimeout(int)
throws java.sql.SQLException] because it is marked as final: Consider using
interface-based JDK proxies instead!
2020-12-12 01:20:00.204 INFO 2228 --- [ main]
o.s.aop.framework.CglibAopProxy : Unable to proxy
interface-implementing method [public final java.lang.Object
org.apache.shardingsphere.driver.jdbc.adapter.WrapperAdapter.unwrap(java.lang.Class)
throws java.sql.SQLException] because it is marked as final: Consider using
interface-based JDK proxies instead!
2020-12-12 01:20:00.204 INFO 2228 --- [ main]
o.s.aop.framework.CglibAopProxy : Unable to proxy
interface-implementing method [public final boolean
org.apache.shardingsphere.driver.jdbc.adapter.WrapperAdapter.isWrapperFor(java.lang.Class)]
because it is marked as final: Consider using interface-based JDK proxies
instead!
2020-12-12 01:20:00.212 WARN 2228 --- [ main]
ConfigServletWebServerApplicationContext : Exception encountered during context
initialization - cancelling refresh attempt:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'accountController': Unsatisfied dependency expressed
through field 'accountService'; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'accountServiceImpl': Unsatisfied dependency expressed
through field 'accountDao'; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'accountDao' defined in file
[H:\Software\JetBrains\IdeaProjects\test\seata-at-feign\account\target\classes\com\lrq\account\dao\AccountDao.class]:
Unsatisfied dependency expressed through bean property 'sqlSessionFactory';
nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error c
reating bean with name 'sqlSessionFactory' defined in class path resource
[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]:
Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter
0; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'shardingSphereDataSource' defined in class path
resource [org/apache/shardingsphere/spring/boot/SpringBootConfiguration.class]:
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name
'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker':
Invocation of init method failed; nested exception is
org.springframework.aop.framework.AopConfigException: Could not generate CGLIB
subclass of class
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource:
Common causes of this problem include using a final class or a non-visible
class; nested
exception is java.lang.IllegalArgumentException: Cannot subclass final class
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource
2020-12-12 01:20:00.218 INFO 2228 --- [ main]
o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-12-12 01:20:00.233 INFO 2228 --- [ main]
ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run
your application with 'debug' enabled.
2020-12-12 01:20:00.258 ERROR 2228 --- [ main]
o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'accountController': Unsatisfied dependency expressed
through field 'accountService'; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'accountServiceImpl': Unsatisfied dependency expressed
through field 'accountDao'; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'accountDao' defined in file
[H:\Software\JetBrains\IdeaProjects\test\seata-at-feign\account\target\classes\com\lrq\account\dao\AccountDao.class]:
Unsatisfied dependency expressed through bean property 'sqlSessionFactory';
nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'sqlSessionFactory' defined in class path resource
[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]:
Unsatisfied dependency expressed thr
ough method 'sqlSessionFactory' parameter 0; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'shardingSphereDataSource' defined in class path resource
[org/apache/shardingsphere/spring/boot/SpringBootConfiguration.class]:
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name
'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker':
Invocation of init method failed; nested exception is
org.springframework.aop.framework.AopConfigException: Could not generate CGLIB
subclass of class
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource:
Common causes of this problem include using a final class or a non-visible
class; nested exception is java.lang.IllegalArgumentException: Cannot subclass
final class
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
~[spring-context-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
~[spring-context-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
~[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405)
[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
[spring-boot-2.3.6.RELEASE.jar:2.3.6.RELEASE]
at com.lrq.account.AccountApplication.main(AccountApplication.java:12)
[classes/:na]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'accountServiceImpl': Unsatisfied dependency
expressed through field 'accountDao'; nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'accountDao' defined in file
[H:\Software\JetBrains\IdeaProjects\test\seata-at-feign\account\target\classes\com\lrq\account\dao\AccountDao.class]:
Unsatisfied dependency expressed through bean property 'sqlSessionFactory';
nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'sqlSessionFactory' defined in class path resource
[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]:
Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter
0; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'shardingSphereDataSource' defined in c
lass path resource
[org/apache/shardingsphere/spring/boot/SpringBootConfiguration.class]:
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error creating bean
with name
'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker':
Invocation of init method failed; nested exception is
org.springframework.aop.framework.AopConfigException: Could not generate CGLIB
subclass of class
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource:
Common causes of this problem include using a final class or a non-visible
class; nested exception is java.lang.IllegalArgumentException: Cannot subclass
final class
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
... 20 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'accountDao' defined in file
[H:\Software\JetBrains\IdeaProjects\test\seata-at-feign\account\target\classes\com\lrq\account\dao\AccountDao.class]:
Unsatisfied dependency expressed through bean property 'sqlSessionFactory';
nested exception is
org.springframework.beans.factory.UnsatisfiedDependencyException: Error
creating bean with name 'sqlSessionFactory' defined in class path resource
[org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]:
Unsatisfied dependency expressed through method 'sqlSessionFactory' parameter
0; nested exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'shardingSphereDataSource' defined in class path
resource [org/apache/shardingsphere/spring/boot/SpringBootConfiguration.class]:
Initialization of bean failed; nested exception is
org.springframework.beans.factory.BeanCreationException: E
rror creating bean with name
'org.springframework.boot.autoconfigure.jdbc.DataSourceInitializerInvoker':
Invocation of init method failed; nested exception is
org.springframework.aop.framework.AopConfigException: Could not generate CGLIB
subclass of class
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource:
Common causes of this problem include using a final class or a non-visible
class; nested exception is java.lang.IllegalArgumentException: Cannot subclass
final class
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1524)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1404)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
at
org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640)
~[spring-beans-5.2.11.RELEASE.jar:5.2.11.RELEASE]
... 33 common frames omitted
```
----------------------------------------------------------------
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]