xcmonline opened a new issue, #32336:
URL: https://github.com/apache/shardingsphere/issues/32336

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   shardingsphere-jdbc 5.5.0
   springboot 2.7.18
   mybatis-plus 3.5.7
   druid 1.2.23
   snakeyaml 2.2
   
   `
           <dependency>
                   <groupId>org.apache.shardingsphere</groupId>
                   <artifactId>shardingsphere-jdbc</artifactId>
                   <version>${shardingsphere-jdbc.version}</version>
                   <exclusions>
                       <exclusion>
                           <groupId>org.apache.shardingsphere</groupId>
                           <artifactId>shardingsphere-test-util</artifactId>
                       </exclusion>
                   </exclusions>
               </dependency>
               <!-- https://mvnrepository.com/artifact/org.yaml/snakeyaml -->
               <dependency>
                   <groupId>org.yaml</groupId>
                   <artifactId>snakeyaml</artifactId>
                   <version>${snakeyaml.version}</version>
               </dependency>
   
               <dependency>
                   <groupId>com.baomidou</groupId>
                   <artifactId>mybatis-plus-boot-starter</artifactId>
                   <version>${mybatis-plus-spring-boot.version}</version>
               </dependency>
   
              <dependency>
                   <groupId>com.alibaba</groupId>
                   <artifactId>druid-spring-boot-starter</artifactId>
                   <version>${druid.version}</version>
               </dependency>
   
               <dependency>
                   <groupId>com.mysql</groupId>
                   <artifactId>mysql-connector-j</artifactId>
                   <version>${mysql-connector.version}</version>
               </dependency>
   `
   
   application.yml
   `
   spring:
     main:
       allow-bean-definition-overriding: true
     datasource:
       driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
       url: jdbc:shardingsphere:classpath:sharding.yml
   `
   sharding.yml
   `
   dataSources:
     master:
       dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
       driverClassName: com.mysql.cj.jdbc.Driver
       url: 
jdbc:mysql://127.0.0.1:33060/test?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
       username: xxx
       password: xxx
     slave_1:
       dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
       driverClassName: com.mysql.cj.jdbc.Driver
       url: 
jdbc:mysql://127.0.0.1:6033/test01?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
       username: xxx
       password: xxx
   rules:
   - !SINGLE
     tables:
       - "*.*"
     defaultDataSource: master
   - !READWRITE_SPLITTING
     dataSourceGroups:
       readwrite_ds:
         writeDataSourceName: master
         readDataSourceNames:
           - slave_1
         transactionalReadQueryStrategy: PRIMARY
         loadBalancerName: random
     loadBalancers:
       random:
         type: RANDOM
   - !SHARDING
     tables:
       obs_data:
         actual-data-nodes: ds_1.obs_data_$->{2024..2999}_$->{01..12}
         table-strategy:
           standard:
             sharding-column: obs_time
             sharding-algorithm-name: obs_data_table_month_inline
         key-generate-strategy:
           column: id
           key-generator-name: snowflake
         key-generators:
           snowflake:
             type: SNOWFLAKE
             column: id
     sharding-algorithms:
       obs_data_table_month_inline:
         type: INLINE
         props:
           algorithm-expression: 
obs_data_$->{year(obs_time)}_$->{month(obs_time)}
   mode:
     type: Standalone
     repository:
       type: JDBC
   props:
     sql-show: true
   `
   
   
   Error Message
   `
   2024-07-30 18:04:55.172 ERROR 25736 --- [eate-1736424643] 
com.alibaba.druid.pool.DruidDataSource   : create connection RuntimeException
   
   org.yaml.snakeyaml.constructor.ConstructorException: Cannot create 
property=rules for 
JavaBean=org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfiguration@424e4678
    in 'reader', line 1, column 1:
       dataSources:
       ^
   Cannot create property=dataSourceGroups for 
JavaBean=org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfiguration@1b58a000
    in 'reader', line 21, column 3:
       - !READWRITE_SPLITTING
         ^
   Unable to find property 'dataSourceGroups' on class: 
org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfiguration
    in 'reader', line 23, column 5:
           readwrite_ds:
           ^
   
    in 'reader', line 17, column 1:
       - !SINGLE
       ^
   
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:283)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:169)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:320)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:264)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:247)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:201)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:185)
 ~[snakeyaml-2.2.jar:na]
        at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:493) 
~[snakeyaml-2.2.jar:na]
        at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:486) ~[snakeyaml-2.2.jar:na]
        at 
org.apache.shardingsphere.infra.util.yaml.YamlEngine.unmarshal(YamlEngine.java:73)
 ~[shardingsphere-infra-util-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:69)
 ~[shardingsphere-jdbc-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.createDataSource(DriverDataSourceCache.java:55)
 ~[shardingsphere-jdbc-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.lambda$get$0(DriverDataSourceCache.java:48)
 ~[shardingsphere-jdbc-5.5.0.jar:5.5.0]
        at 
java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
 ~[na:na]
        at 
org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.get(DriverDataSourceCache.java:48)
 ~[shardingsphere-jdbc-5.5.0.jar:5.5.0]
        at 
org.apache.shardingsphere.driver.ShardingSphereDriver.connect(ShardingSphereDriver.java:56)
 ~[shardingsphere-jdbc-5.5.0.jar:5.5.0]
        at 
com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1682)
 ~[druid-1.2.23.jar:na]
        at 
com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1803)
 ~[druid-1.2.23.jar:na]
        at 
com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2914)
 ~[druid-1.2.23.jar:na]
   Caused by: org.yaml.snakeyaml.constructor.ConstructorException: Cannot 
create property=dataSourceGroups for 
JavaBean=org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfiguration@1b58a000
    in 'reader', line 21, column 3:
       - !READWRITE_SPLITTING
         ^
   Unable to find property 'dataSourceGroups' on class: 
org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfiguration
    in 'reader', line 23, column 5:
           readwrite_ds:
           ^
   
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:283)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:169)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:320)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:264)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:247)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructSequenceStep2(BaseConstructor.java:464)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructSequence(BaseConstructor.java:430)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructSequence.construct(Constructor.java:522)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:264)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:247)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.newInstance(Constructor.java:295)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:260)
 ~[snakeyaml-2.2.jar:na]
        ... 18 common frames omitted
   Caused by: org.yaml.snakeyaml.error.YAMLException: Unable to find property 
'dataSourceGroups' on class: 
org.apache.shardingsphere.readwritesplitting.yaml.config.YamlReadwriteSplittingRuleConfiguration
        at 
org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:155)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:145)
 ~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.TypeDescription.discoverProperty(TypeDescription.java:166) 
~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.TypeDescription.getProperty(TypeDescription.java:177) 
~[snakeyaml-2.2.jar:na]
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:224)
 ~[snakeyaml-2.2.jar:na]
        ... 29 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.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to