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

   ```text
   Exception in thread "main" Cannot create property=mode for 
JavaBean=org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration@1700915
    in 'reader', line 1, column 1:
       databaseName: oracleSource
       ^
   No single argument constructor found for class 
org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration
    in 'reader', line 2, column 7:
       mode: standalone
             ^
   
        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 Test.main(Test.java:30)
   Caused by: org.yaml.snakeyaml.error.YAMLException: No single argument 
constructor found for class 
org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration
        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.Constructor$ConstructMapping.newInstance(Constructor.java:333)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:298)
        ... 11 more
   ```
   scratch.yaml
   ```text
   databaseName: oracleSource
   mode: standalone
   dataSources:
     oracleSource1:
       dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
       driverClassName: oracle.jdbc.driver.OracleDriver
       jdbcUrl: jdbc:oracle:thin:@******:road
       username: 1111
       password: 1111
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
     oracleSource2:
       dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
       driverClassName: oracle.jdbc.driver.OracleDriver
       jdbcUrl: jdbc:oracle:thin:@******:road1
       username: 1111
       password: 1111
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
     oracleSource3:
       dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
       driverClassName: oracle.jdbc.driver.OracleDriver
       jdbcUrl: jdbc:oracle:thin:@******:road2
       username: 1111
       password: 1111
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   
   rules:
       tables:
         MJM_GPS_RECORD:
           actualDataNodes: oracleSource${1..3}.MJM_GPS_RECORD
           databaseStrategy:
             standard:
               shardingColumn: TELEPHONE
               shardingAlgorithmName: hint_test
         MJM_JS_ATTACHMENT:
           actualDataNodes: oracleSource${1..3}.MJM_JS_ATTACHMENT
           databaseStrategy:
             standard:
               shardingColumn: SIM_NUMBER
               shardingAlgorithmName: hint_test
         MJM_JS_BLIND_AREA:
           actualDataNodes: oracleSource${1..3}.MJM_JS_BLIND_AREA
           databaseStrategy:
             standard:
               shardingColumn: SIM_NUMBER
               shardingAlgorithmName: hint_test
         MJM_JS_DRIVER_STATUS:
           actualDataNodes: oracleSource${1..3}.MJM_JS_DRIVER_STATUS
           databaseStrategy:
             standard:
               shardingColumn: SIM_NUMBER
               shardingAlgorithmName: hint_test
         MJM_JS_DRIVING_ASS:
           actualDataNodes: oracleSource${1..3}.MJM_JS_DRIVING_ASS
           databaseStrategy:
             standard:
               shardingColumn: SIM_NUMBER
               shardingAlgorithmName: hint_test
         MJM_WARNING:
           actualDataNodes: oracleSource${1..3}.MJM_WARNING
           databaseStrategy:
             standard:
               shardingColumn: SIM_NUMBER
               shardingAlgorithmName: hint_test
       bindingTables: 
MJM_GPS_RECORD,MJM_JS_ATTACHMENT,MJM_JS_BLIND_AREA,MJM_JS_DRIVER_STATUS,MJM_JS_DRIVING_ASS,MJM_WARNING
       broadcastTables: 
MJM_REPORT_LAST_POSITION,MJM_8702,T_SERVER_DB,T_GPS_RECORD_LOG_JOB,MJM_PICTURE_MATCH
   
       shardingAlgorithms:
         hint_test:
           type: HINT_TEST
   props:
     max-connections-size-per-query: 1
     kernel-executor-size: 16  # Infinite by default.
     proxy-frontend-flush-threshold: 128  # The default value is 128.
     proxy-hint-enabled: true
     sql-show: true
     check-table-metadata-enabled: false
   ```
   spring-datasource.xml
   ```text
   <?xml version="1.0" encoding="UTF-8"?>
   <beans xmlns="http://www.springframework.org/schema/beans";
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
          xmlns:context="http://www.springframework.org/schema/context";
          
xmlns:sharding="http://shardingsphere.apache.org/schema/shardingsphere/sharding";
          xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context.xsd
          http://www.springframework.org/schema/jdbc
          http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
          http://shardingsphere.apache.org/schema/shardingsphere/sharding
          
http://shardingsphere.apache.org/schema/shardingsphere/sharding/sharding.xsd";>
   
       <context:property-placeholder location="classpath:db.properties" 
ignore-unresolvable="true"/>
   
       <bean id="stat-filter" class="com.alibaba.druid.filter.stat.StatFilter">
           <property name="slowSqlMillis" value="2000"/>
           <property name="logSlowSql" value="true"/>
       </bean>
   
   
       <bean id="dataSource" class="DynamicDataSource" >
           <property name="targetDataSources">
               <map>
                   <entry key="mysqlSource" value-ref="mysqlSource"/>
                   <entry key="mysqlSourceBj" value-ref="mysqlSourceBj"/>
                   <entry key="oracleSource" value-ref="oracleSource"/>
   <!--                <entry key="oracleSource" 
value-ref="shardingDataSource"/>-->
   <!--                <entry key="h2Source" value-ref="h2Source" />-->
               </map>
           </property>
           <property name="defaultTargetDataSource" ref="mysqlSource"/>
       </bean>
   
       <bean id="parentSource" class="com.alibaba.druid.pool.DruidDataSource">
           <!-- 配置获取连接等待超时的时间 -->
           <property name="maxWait" value="${jdbc.maxWait}"/>
           <!-- 初始大小 -->
           <property name="initialSize" value="${jdbc.initialSize}"/>
           <!-- 最小个数 -->
           <property name="minIdle" value="${jdbc.minIdle}"/>
           <!-- 最大个数 -->
           <property name="maxActive" value="${jdbc.maxActive}"/>
   
           <!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
           <!--  
如果用Oracle,则把poolPreparedStatements配置为true,mysql可以配置为false。分库分表较多的数据库,建议配置为false。-->
           <property name="poolPreparedStatements" value="false"/>
           <property name="maxPoolPreparedStatementPerConnectionSize" 
value="20"/>
   
           <property name="filters" value="${jdbc.filters}"/>
           <property name="timeBetweenEvictionRunsMillis" 
value="${jdbc.timeBetweenEvictionRunsMillis}"/>
           <property name="minEvictableIdleTimeMillis" 
value="${jdbc.minEvictableIdleTimeMillis}"/>
           <property name="testWhileIdle" value="${jdbc.testWhileIdle}"/>
           <property name="testOnBorrow" value="${jdbc.testOnBorrow}"/>
           <property name="testOnReturn" value="${jdbc.testOnReturn}"/>
   
           <!-- 启用监控 -->
           <property name="proxyFilters">
               <list>
                   <ref bean="stat-filter"/>
               </list>
           </property>
           <property name="connectionProperties">
               <value>${jdbc.connproperty}</value>
           </property>
       </bean>
   
       <bean id="mysqlSource" parent="parentSource" init-method="init" 
destroy-method="close">
           <property name="driverClassName" value="${jdbc.driverClassName}"/>
           <property name="url" value="${jdbc.url}"/>
           <property name="username" value="${jdbc.username}"/>
           <property name="password" value="${jdbc.password}"/>
           <property name="validationQuery" value="select 1"/>
       </bean>
       <bean id="mysqlSourceBj" parent="parentSource" init-method="init" 
destroy-method="close">
           <property name="driverClassName" value="${jdbc.driverClassName1}"/>
           <property name="url" value="${jdbc.url1}"/>
           <property name="username" value="${jdbc.username1}"/>
           <property name="password" value="${jdbc.password1}"/>
           <property name="validationQuery" value="select 1"/>
       </bean>
       <bean id="oracleSource" parent="parentSource" init-method="init" 
destroy-method="close">
           <property name="driverClassName" 
value="org.apache.shardingsphere.driver.ShardingSphereDriver"/>
           <property name="url" 
value="jdbc:shardingsphere:classpath:scratch.yaml" />
       </bean>
   
   </beans>
   ```
   


-- 
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