You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/12/28 11:28:42 UTC
[GitHub] [shardingsphere] pengxianggui opened a new issue, #23143: org.yaml.snakeyaml.error.YAMLException: No single argument constructor found for interface java.util.Collection
pengxianggui opened a new issue, #23143:
URL: https://github.com/apache/shardingsphere/issues/23143
> Spring Boot starter has been deprecated and removed since 5.3.0. There is a more simple way to integrate ShardingSphere with Spring Boot. You may refer to: https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/spring-boot/
> I'm from https://github.com/apache/shardingsphere/issues/23131
@TeslaCN Sorry to bother you again...
I can't use this way to to integrate ShardingSphere with Spring Boot cause It will affects the other component. I decided to define a bean myself with the following code, which I'm not sure is feasible:
```
@Primary
@Bean
DataSource shardingSphereDatasource() throws IOException, SQLException {
return YamlShardingSphereDataSourceFactory.createDataSource(getFile("classpath:sharding-table.yml"));
}
```
The other relevant code is the sharding-table.yml file.
The file content as follow:
```
# shardingsphere 5.3.0文档 https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding/
dataSources:
db0: # 单数据库节点无意义,当存在多个时用于区分
dataSourceClassName: com.zaxxer.hikari.HikariDataSource # 数据库连接池全类名
driverClassName: ${spring.datasource.driver-class-name}
jdbcUrl: ${spring.datasource.url}
username: ${spring.datasource.username}
password: ${spring.datasource.password}
props:
sql-show: true
rules:
- !SHARDING
broadcastTables: t_alarm_domain # 广播表规则列表
bindingTables: # 绑定表规则列表。见: https://github.com/apache/shardingsphere/issues/21002
- t_alarm,t_sensor_alarm
- t_alarm,t_video_alarm
- t_alarm,t_device_offline_alarm
- t_alarm,t_alarm_handle
tables: # 单分片键的标准分片场景
t_alarm:
actualDataNodes: db0.t_alarm_$->{2022..2025}
tableStrategy:
standard:
shardingColumns: alarm_time
shardingAlgorithmName: time-inline
t_sensor_alarm:
actualDataNodes: db0.t_sensor_alarm_$->{2022..2025}
tableStrategy:
standard:
shardingColumns: alarm_time
shardingAlgorithmName: time-inline
t_video_alarm:
actualDataNodes: db0.t_video_alarm_$->{2022..2025}
tableStrategy:
standard:
shardingColumns: alarm_time
shardingAlgorithmName: time-inline
t_device_offline_alarm:
actualDataNodes: db0.t_device_offline_alarm_$->{2022..2025}
tableStrategy:
standard:
shardingColumns: alarm_time
shardingAlgorithmName: time-inline
t_alarm_handle:
actualDataNodes: db0.t_alarm_handle_$->{2022..2025}
tableStrategy:
standard:
shardingColumns: alarm_time
shardingAlgorithmName: time-inline
shardingAlgorithms:
time-inline:
type: CLASS_BASED
props:
strategy: standard
algorithmClassName: cn.com.asoco.alarm_platform.server.sharding.AlarmTimeShardingAlgorithm # 使用自定义类实现分片逻辑处理
```
But i get error:
```
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmClient' defined in file [/Users/pengxianggui/project/gitlab/asoco-product/asoco-alarm-platform/alarm-server/target/classes/cn/com/asoco/alarm_platform/server/client/AlarmClient.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'alarmService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sendConfig' defined in file [/Users/pengxianggui/project/gitlab/asoco-product/asoco-alarm-platform/alarm-server/target/classes/cn/com/asoco/alarm_platform/server/send/SendConfig.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean w
ith name 'alarmDomainService' defined in file [/Users/pengxianggui/project/gitlab/asoco-product/asoco-alarm-platform/alarm-server/target/classes/cn/com/asoco/alarm_platform/server/service/AlarmDomainService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmDomainMapper' defined in file [/Users/pengxianggui/project/gitlab/asoco-product/asoco-alarm-platform/alarm-server/target/classes/cn/com/asoco/alarm_platform/server/dao/AlarmDomainMapper.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 [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.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 [cn/com/asoco/alarm_platform/server/sharding/ShardingSphereConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'shardingSphereDatasource' threw exception; nested exception is Cannot create property=rules for JavaBean=org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration@58a5b69c
in 'reader', line 2, column 1:
dataSources:
^
No single argument constructor found for interface org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration
in 'reader', line 23, column 3:
broadcastTables: t_alarm_domain ...
^
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:797)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:227)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1356)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1203)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
at cn.com.asoco.alarm_platform.server.AlarmPlatformApplication.main(AlarmPlatformApplication.java:29)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'alarmService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sendConfig' defined in file [/Users/pengxianggui/project/gitlab/asoco-product/asoco-alarm-platform/alarm-server/target/classes/cn/com/asoco/alarm_platform/server/send/SendConfig.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmDomainService' defined in file [/Users/pengxianggui/project/gitlab/asoco-product/asoco-alarm-platform/alarm-server/target/classes/cn/com/asoco/alarm_platform/server/service/AlarmDomainService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyExcept
ion: Error creating bean with name 'alarmDomainMapper' defined in file [/Users/pengxianggui/project/gitlab/asoco-product/asoco-alarm-platform/alarm-server/target/classes/cn/com/asoco/alarm_platform/server/dao/AlarmDomainMapper.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 [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.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 [cn/com/asoco/alarm_platform/server/sharding/ShardingSphereConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Fa
iled to instantiate [javax.sql.DataSource]: Factory method 'shardingSphereDatasource' threw exception; nested exception is Cannot create property=rules for JavaBean=org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration@58a5b69c
in 'reader', line 2, column 1:
dataSources:
^
No single argument constructor found for interface org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration
in 'reader', line 23, column 3:
broadcastTables: t_alarm_domain ...
^
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:321)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:884)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788)
... 19 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sendConfig' defined in file [/Users/pengxianggui/project/gitlab/asoco-product/asoco-alarm-platform/alarm-server/target/classes/cn/com/asoco/alarm_platform/server/send/SendConfig.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmDomainService' defined in file [/Users/pengxianggui/project/gitlab/asoco-product/asoco-alarm-platform/alarm-server/target/classes/cn/com/asoco/alarm_platform/server/service/AlarmDomainService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmDomainMapper' defined in file [/Users/pengxianggui/project/gitlab/asoco-product/asoco-alarm-platform/alarm-server/target/clas
ses/cn/com/asoco/alarm_platform/server/dao/AlarmDomainMapper.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 [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.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 [cn/com/asoco/alarm_platform/server/sharding/ShardingSphereConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'shardingSphereDatasource' threw exception; nested exception is Cannot create property=rules for JavaBean=o
rg.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration@58a5b69c
in 'reader', line 2, column 1:
dataSources:
^
No single argument constructor found for interface org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration
in 'reader', line 23, column 3:
broadcastTables: t_alarm_domain ...
^
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:797)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:227)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1356)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1203)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:408)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:207)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeanByName(AbstractAutowireCapableBeanFactory.java:453)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:527)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:497)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:650)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:239)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:318)
... 31 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmDomainService' defined in file [/Users/pengxianggui/project/gitlab/asoco-product/asoco-alarm-platform/alarm-server/target/classes/cn/com/asoco/alarm_platform/server/service/AlarmDomainService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmDomainMapper' defined in file [/Users/pengxianggui/project/gitlab/asoco-product/asoco-alarm-platform/alarm-server/target/classes/cn/com/asoco/alarm_platform/server/dao/AlarmDomainMapper.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 [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoCo
nfiguration.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 [cn/com/asoco/alarm_platform/server/sharding/ShardingSphereConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'shardingSphereDatasource' threw exception; nested exception is Cannot create property=rules for JavaBean=org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration@58a5b69c
in 'reader', line 2, column 1:
dataSources:
^
No single argument constructor found for interface org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration
in 'reader', line 23, column 3:
broadcastTables: t_alarm_domain ...
^
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:797)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:227)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1356)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1203)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:884)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788)
... 56 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'alarmDomainMapper' defined in file [/Users/pengxianggui/project/gitlab/asoco-product/asoco-alarm-platform/alarm-server/target/classes/cn/com/asoco/alarm_platform/server/dao/AlarmDomainMapper.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 [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.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 [cn/com/asoco/alarm_platform/server/sharding/ShardingSphereConfig.class]: Bean instantiation via factory method failed; ne
sted exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'shardingSphereDatasource' threw exception; nested exception is Cannot create property=rules for JavaBean=org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration@58a5b69c
in 'reader', line 2, column 1:
dataSources:
^
No single argument constructor found for interface org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration
in 'reader', line 23, column 3:
broadcastTables: t_alarm_domain ...
^
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1524)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1404)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:884)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788)
... 70 common frames omitted
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.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 [cn/com/asoco/alarm_platform/server/sharding/ShardingSphereConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'shardingSphereDatasource' threw exception; nested exception is Cannot create property=rules for JavaBean=org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration@58a5b69c
in 'reader', line 2, column 1:
dataSources:
^
No single argument constructor found for interface org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration
in 'reader', line 23, column 3:
broadcastTables: t_alarm_domain ...
^
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:797)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:538)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByType(AbstractAutowireCapableBeanFactory.java:1509)
... 82 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'shardingSphereDatasource' defined in class path resource [cn/com/asoco/alarm_platform/server/sharding/ShardingSphereConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'shardingSphereDatasource' threw exception; nested exception is Cannot create property=rules for JavaBean=org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration@58a5b69c
in 'reader', line 2, column 1:
dataSources:
^
No single argument constructor found for interface org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration
in 'reader', line 23, column 3:
broadcastTables: t_alarm_domain ...
^
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:655)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:483)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:884)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788)
... 95 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'shardingSphereDatasource' threw exception; nested exception is Cannot create property=rules for JavaBean=org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration@58a5b69c
in 'reader', line 2, column 1:
dataSources:
^
No single argument constructor found for interface org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration
in 'reader', line 23, column 3:
broadcastTables: t_alarm_domain ...
^
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650)
... 109 common frames omitted
Caused by: org.yaml.snakeyaml.constructor.ConstructorException: Cannot create property=rules for JavaBean=org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration@58a5b69c
in 'reader', line 2, column 1:
dataSources:
^
No single argument constructor found for interface org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration
in 'reader', line 23, column 3:
broadcastTables: t_alarm_domain ...
^
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:321)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:207)
at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:358)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:270)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:253)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:207)
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:191)
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:477)
at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:443)
at org.apache.shardingsphere.infra.util.yaml.YamlEngine.unmarshal(YamlEngine.java:55)
at org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:61)
at cn.com.asoco.alarm_platform.server.sharding.ShardingSphereConfig.shardingSphereDatasource(ShardingSphereConfig.java:26)
at cn.com.asoco.alarm_platform.server.sharding.ShardingSphereConfig$$EnhancerBySpringCGLIB$$23edcc1.CGLIB$shardingSphereDatasource$0(<generated>)
at cn.com.asoco.alarm_platform.server.sharding.ShardingSphereConfig$$EnhancerBySpringCGLIB$$23edcc1$$FastClassBySpringCGLIB$$c41430c2.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
at cn.com.asoco.alarm_platform.server.sharding.ShardingSphereConfig$$EnhancerBySpringCGLIB$$23edcc1.shardingSphereDatasource(<generated>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 110 common frames omitted
Caused by: org.yaml.snakeyaml.error.YAMLException: No single argument constructor found for interface org.apache.shardingsphere.infra.yaml.config.pojo.rule.YamlRuleConfiguration
at org.yaml.snakeyaml.constructor.Constructor$ConstructScalar.construct(Constructor.java:417)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:270)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:253)
at org.yaml.snakeyaml.constructor.SafeConstructor.processDuplicateKeys(SafeConstructor.java:108)
at org.yaml.snakeyaml.constructor.SafeConstructor.flattenMapping(SafeConstructor.java:81)
at org.yaml.snakeyaml.constructor.SafeConstructor.flattenMapping(SafeConstructor.java:76)
at org.yaml.snakeyaml.constructor.SafeConstructor.constructSet2ndStep(SafeConstructor.java:218)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructSet(BaseConstructor.java:545)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:199)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:270)
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:253)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.newInstance(Constructor.java:333)
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:298)
... 131 common frames omitted
```
I had upgrade snakeyml to 1.33...
I don't know what I did wrong...
Thank you for help so much!
--
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] TeslaCN closed issue #23143: org.yaml.snakeyaml.error.YAMLException: No single argument constructor found for interface java.util.Collection
Posted by GitBox <gi...@apache.org>.
TeslaCN closed issue #23143: org.yaml.snakeyaml.error.YAMLException: No single argument constructor found for interface java.util.Collection
URL: https://github.com/apache/shardingsphere/issues/23143
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] pengxianggui commented on issue #23143: org.yaml.snakeyaml.error.YAMLException: No single argument constructor found for interface java.util.Collection
Posted by GitBox <gi...@apache.org>.
pengxianggui commented on issue #23143:
URL: https://github.com/apache/shardingsphere/issues/23143#issuecomment-1367041409
> Hi @pengxianggui `broadcastTables` is also a list. Please try the following format:
>
> ```yaml
> - !SHARDING
> broadcastTables:
> - t_alarm_domain
> ```
My mistake, I forgot to update my configuration for version 5.3.0
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] TeslaCN commented on issue #23143: org.yaml.snakeyaml.error.YAMLException: No single argument constructor found for interface java.util.Collection
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #23143:
URL: https://github.com/apache/shardingsphere/issues/23143#issuecomment-1367021186
Hi @pengxianggui
`broadcastTables` is also a list. Please try the following format:
```yaml
- !SHARDING
broadcastTables:
- t_alarm_domain
```
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org