dafanzhi opened a new issue #8629:
URL: https://github.com/apache/shardingsphere/issues/8629


   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   
   apache-shardingsphere-5.0.0-alpha-shardingsphere-proxy
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   shardingsphere-proxy
   
   ### Expected behavior
   The proxy server should be started normally.
   
   ### Actual behavior
   Throws exceptions when starting server.
   Error log:
   ```
   Exception in thread "main" Cannot create property=rules for 
JavaBean=org.apache.shardingsphere.proxy.config.yaml.YamlProxyRuleConfiguration@55f3ddb1
    in 'reader', line 25, column 1:
       schemaName: sharding
       ^
   Cannot create property=tables for 
JavaBean=org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration@cc285f4
    in 'reader', line 60, column 3:
       - !SHARDING
         ^
   Cannot create property=databaseStrategy for 
JavaBean=org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration@c038203
    in 'reader', line 63, column 7:
             actualDataNodes: ds_${0..1}.proj ... 
             ^
   Cannot create property=inline for 
JavaBean=org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration@29ee9faa
    in 'reader', line 65, column 9:
               inline:
               ^
   Unable to find property 'inline' on class: 
org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration
    in 'reader', line 66, column 11:
                 shardingColumn: id
                 ^
   
    in 'reader', line 65, column 9:
               inline:
               ^
   
    in 'reader', line 62, column 5:
           project: 
           ^
   
    in 'reader', line 60, column 1:
       - !SHARDING
       ^
   
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:312)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:189)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:345)
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:141)
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:127)
        at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:450)
        at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:410)
        at 
org.apache.shardingsphere.infra.yaml.engine.YamlEngine.unmarshal(YamlEngine.java:58)
        at 
org.apache.shardingsphere.proxy.config.ProxyConfigurationLoader.loadRuleConfiguration(ProxyConfigurationLoader.java:95)
        at 
org.apache.shardingsphere.proxy.config.ProxyConfigurationLoader.loadRuleConfigurations(ProxyConfigurationLoader.java:86)
        at 
org.apache.shardingsphere.proxy.config.ProxyConfigurationLoader.load(ProxyConfigurationLoader.java:62)
        at org.apache.shardingsphere.proxy.Bootstrap.main(Bootstrap.java:47)
   Caused by: Cannot create property=tables for 
JavaBean=org.apache.shardingsphere.sharding.yaml.config.YamlShardingRuleConfiguration@cc285f4
    in 'reader', line 60, column 3:
       - !SHARDING
         ^
   Cannot create property=databaseStrategy for 
JavaBean=org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration@c038203
    in 'reader', line 63, column 7:
             actualDataNodes: ds_${0..1}.proj ... 
             ^
   Cannot create property=inline for 
JavaBean=org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration@29ee9faa
    in 'reader', line 65, column 9:
               inline:
               ^
   Unable to find property 'inline' on class: 
org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration
    in 'reader', line 66, column 11:
                 shardingColumn: id
                 ^
   
    in 'reader', line 65, column 9:
               inline:
               ^
   
    in 'reader', line 62, column 5:
           project: 
           ^
   
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:312)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:189)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:345)
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructSequenceStep2(BaseConstructor.java:275)
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructSequence(BaseConstructor.java:246)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructSequence.construct(Constructor.java:536)
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:297)
        ... 12 more
   Caused by: Cannot create property=databaseStrategy for 
JavaBean=org.apache.shardingsphere.sharding.yaml.config.rule.YamlTableRuleConfiguration@c038203
    in 'reader', line 63, column 7:
             actualDataNodes: ds_${0..1}.proj ... 
             ^
   Cannot create property=inline for 
JavaBean=org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration@29ee9faa
    in 'reader', line 65, column 9:
               inline:
               ^
   Unable to find property 'inline' on class: 
org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration
    in 'reader', line 66, column 11:
                 shardingColumn: id
                 ^
   
    in 'reader', line 65, column 9:
               inline:
               ^
   
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:312)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:189)
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:373)
        at 
org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:147)
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:354)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:170)
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:297)
        ... 20 more
   Caused by: Cannot create property=inline for 
JavaBean=org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration@29ee9faa
    in 'reader', line 65, column 9:
               inline:
               ^
   Unable to find property 'inline' on class: 
org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration
    in 'reader', line 66, column 11:
                 shardingColumn: id
                 ^
   
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:312)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:189)
        at 
org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:182)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:297)
        ... 28 more
   Caused by: org.yaml.snakeyaml.error.YAMLException: Unable to find property 
'inline' on class: 
org.apache.shardingsphere.sharding.yaml.config.strategy.sharding.YamlShardingStrategyConfiguration
        at 
org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:132)
        at 
org.yaml.snakeyaml.introspector.PropertyUtils.getProperty(PropertyUtils.java:121)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.getProperty(Constructor.java:322)
        at 
org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:240)
        ... 31 more
   ```
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   S1: Configurate conf/server.yaml
   ```yaml
   uthentication:
   
    users:
      root:
        password: root
      sharding:
        password: sharding 
        authorizedSchemas: sharding
   
   props:
    max-connections-size-per-query: 1
    acceptor-size: 16  # The default value is available processors count * 2.
    executor-size: 16  # Infinite by default.
    proxy-frontend-flush-threshold: 128  # The default value is 128.
      # LOCAL: Proxy will run with LOCAL transaction.
      # XA: Proxy will run with XA transaction.
      # BASE: Proxy will run with B.A.S.E transaction.
    proxy-transaction-type: LOCAL
    proxy-opentracing-enabled: false
    proxy-hint-enabled: false
    query-with-cipher-column: true
    sql-show: false
    check-table-metadata-enabled: false
   ```
   
   S2: Configurate conf/config-sharding.yaml
   ```
   schemaName: sharding
   
   dataSources:
     ds_0:
       url: 
jdbc:mysql://120.55.83.27:3306/enhancer_project_0?serverTimezone=UTC&useSSL=false
       username: zyz
       password: passw0rd
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
       maintenanceIntervalMilliseconds: 30000
     ds_1:
       url: 
jdbc:mysql://47.99.192.24:3306/enhancer_project_1?serverTimezone=UTC&useSSL=false
       username: zyz
       password: passw0rd
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
       maintenanceIntervalMilliseconds: 30000
    
   rules:
   - !SHARDING
     tables:
       project: 
         actualDataNodes: ds_${0..1}.project_${0..1}
         databaseStrategy:
           inline:
             shardingColumn: id
             algorithmExpression: ds_${id % 2}
         tableStrategy: 
           inline:
             shardingColumn: id
             algorithmExpression: project_${id % 2}
         keyGeneratorColumnName: id
   
     bindingTables:
       - project
     defaultTableStrategy:
       none:
     defaultKeyGeneratorClassName: 
io.shardingsphere.core.keygen.DefaultKeyGenerator
   ```
   
   The two config files above are just copied from the official example with 
little changes: 
https://github.com/apache/shardingsphere/tree/master/examples/shardingsphere-proxy-example/shardingsphere-proxy-boot-mybatis-example/src/main/resources/conf


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


Reply via email to