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/07/01 05:50:10 UTC

[GitHub] [shardingsphere] flyduckforever opened a new issue, #18759: sharing-proxy start error: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration

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

   ### sharind-proxy start error message:
   
   `Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration
           at org.apache.shardingsphere.infra.yaml.config.swapper.YamlRuleConfigurationSwapperEngine$$Lambda$16/557023567.apply(Unknown Source)
           at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
           at java.util.Iterator.forEachRemaining(Iterator.java:116)
           at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
           at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512)
           at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502)
           at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
           at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
           at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
           at org.apache.shardingsphere.infra.yaml.config.swapper.YamlRuleConfigurationSwapperEngine.swapToRuleConfigurations(YamlRuleConfigurationSwapperEngine.java:59)
           at org.apache.shardingsphere.proxy.backend.config.yaml.swapper.YamlProxyConfigurationSwapper.swapDatabaseConfigurations(YamlProxyConfigurationSwapper.java:63)
           at org.apache.shardingsphere.proxy.backend.config.yaml.swapper.YamlProxyConfigurationSwapper.swap(YamlProxyConfigurationSwapper.java:52)
           at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.createContextManager(BootstrapInitializer.java:62)
           at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.init(BootstrapInitializer.java:55)
           at org.apache.shardingsphere.proxy.Bootstrap.main(Bootstrap.java:50)`
   
   
   
   
   
   
   
   
   
   ### server.xml:
   `rules:
     - !AUTHORITY
       users:
         - root@%:root
         - sharding@:sharding
       provider:
         type: ALL_PERMITTED
   #  - !TRANSACTION
   #    defaultType: XA
   #    providerType: Atomikos
   #    # When the provider type is Narayana, the following properties can be configured or not
   #    props:
   #      recoveryStoreUrl: jdbc:mysql://127.0.0.1:3306/jbossts
   #      recoveryStoreDataSource: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
   #      recoveryStoreUser: root
   #      recoveryStorePassword: 12345678
   #  - !SQL_PARSER
   #    sqlCommentParseEnabled: true
   #    sqlStatementCache:
   #      initialCapacity: 2000
   #      maximumSize: 65535
   #    parseTreeCache:
   #      initialCapacity: 128
   #      maximumSize: 1024
   
   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: false
     sql-show: true
     sql-simple: true
     check-table-metadata-enabled: false
     show-process-list-enabled: false
       # Proxy backend query fetch size. A larger value may increase the memory usage of ShardingSphere Proxy.
       # The default value is -1, which means set the minimum value for different JDBC drivers.
     proxy-backend-query-fetch-size: -1
     check-duplicate-table-enabled: false
     proxy-frontend-executor-size: 0 # Proxy frontend executor size. The default value is 0, which means let Netty decide.
       # Available options of proxy backend executor suitable: OLAP(default), OLTP. The OLTP option may reduce time cost of writing packets to client, but it may increase the latency of SQL execution
       # and block other clients if client connections are more than `proxy-frontend-executor-size`, especially executing slow SQL.
     proxy-backend-executor-suitable: OLAP
     proxy-frontend-max-connections: 0 # Less than or equal to 0 means no limitation.
     sql-federation-enabled: false
       # Available proxy backend driver type: JDBC (default), ExperimentalVertx
     proxy-backend-driver-type: JDBC
     proxy-mysql-default-version: 5.7.22 # In the absence of schema name, the default version will be used.
     proxy-default-port: 3307 # Proxy default port.
     proxy-netty-backlog: 1024 # Proxy netty backlog.
   `
   
   
   
   
   
   
   
   
   ### config-sharding.xml:
   `databaseName: decard_pay_dev
   
   dataSources:
     ds0:
       url: jdbc:mysql://127.0.0.1:3306/decard_pay_dev?serverTimezone=UTC&useSSL=false
       username: root
       password: root
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
   
   
   rules:
     sharding:
       tables:
         dp_trade_payment_order:
           # 配置数据节点
           actual-data-nodes: ds0.dp_trade_payment_order_$->{2020..2025}_0$->{1..4}
           # 分表策略
           table-strategy:
             complex:
               sharding-columns: platform_order_no,order_time,pay_success_time
               sharding-algorithm-name: order-algorithm
         dp_trade_payment_record:
           # 配置数据节点
           actual-data-nodes: ds0.dp_trade_payment_record_$->{2020..2025}_0$->{1..4}
           # 分表策略
           table-strategy:
             complex:
               sharding-columns: platform_order_no,pay_success_time
               sharding-algorithm-name: order-algorithm
       sharding-algorithms:
         order-algorithm:
           type: CLASS_BASED
           props:
             strategy: COMPLEX
             algorithmClassName: com.decard.sharding.config.OrderComplexKeysShardingAlgorithm
       binding-tables: dp_trade_payment_order,dp_trade_payment_record
   `
   
   


-- 
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] flyduckforever closed issue #18759: sharing-proxy start error: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration

Posted by GitBox <gi...@apache.org>.
flyduckforever closed issue #18759: sharing-proxy start error: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration
URL: https://github.com/apache/shardingsphere/issues/18759


-- 
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] flyduckforever commented on issue #18759: sharing-proxy start error: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration

Posted by GitBox <gi...@apache.org>.
flyduckforever commented on issue #18759:
URL: https://github.com/apache/shardingsphere/issues/18759#issuecomment-1172984853

   There is a problem with the previous bindtables configuration
   Correct configuration:
   
   
   config-sharding.yml
   
   ```
   rules:
   - !SHARDING
       tables:
         dp_trade_payment_order:
           # 配置数据节点
           actualDataNodes: ds0.dp_trade_payment_order_$->{2020..2025}_0$->{1..4}
           # 分表策略
           tableStrategy:
             complex:
               shardingColumns: platform_order_no,order_time,pay_success_time
               shardingAlgorithmName: order-algorithm
         dp_trade_payment_record:
           # 配置数据节点
           actualDataNodes: ds0.dp_trade_payment_record_$->{2020..2025}_0$->{1..4}
           # 分表策略
           tableStrategy:
             complex:
               shardingColumns: platform_order_no,pay_success_time
               shardingAlgorithmName: order-algorithm
       shardingAlgorithms:
         order-algorithm:
           type: CLASS_BASED
           props:
             strategy: COMPLEX
             algorithmClassName: com.decard.sharding.config.OrderComplexKeysShardingAlgorithm
       bindingTables: 
         - dp_trade_payment_order
         - dp_trade_payment_record
   ```
   


-- 
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] flyduckforever commented on issue #18759: sharing-proxy start error: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration

Posted by GitBox <gi...@apache.org>.
flyduckforever commented on issue #18759:
URL: https://github.com/apache/shardingsphere/issues/18759#issuecomment-1172862332

   finish


-- 
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] flyduckforever commented on issue #18759: sharing-proxy start error: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration

Posted by GitBox <gi...@apache.org>.
flyduckforever commented on issue #18759:
URL: https://github.com/apache/shardingsphere/issues/18759#issuecomment-1172862295

   > ### sharind-proxy start error message:
   > `Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration at org.apache.shardingsphere.infra.yaml.config.swapper.YamlRuleConfigurationSwapperEngine$$Lambda$16/557023567.apply(Unknown Source) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Iterator.forEachRemaining(Iterator.java:116) at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at org.apache.shardingsphere.infra.yaml.config.swapper.YamlRuleConfigurationSwapperEngine.swapTo
 RuleConfigurations(YamlRuleConfigurationSwapperEngine.java:59) at org.apache.shardingsphere.proxy.backend.config.yaml.swapper.YamlProxyConfigurationSwapper.swapDatabaseConfigurations(YamlProxyConfigurationSwapper.java:63) at org.apache.shardingsphere.proxy.backend.config.yaml.swapper.YamlProxyConfigurationSwapper.swap(YamlProxyConfigurationSwapper.java:52) at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.createContextManager(BootstrapInitializer.java:62) at org.apache.shardingsphere.proxy.initializer.BootstrapInitializer.init(BootstrapInitializer.java:55) at org.apache.shardingsphere.proxy.Bootstrap.main(Bootstrap.java:50)`
   > 
   > ### server.xml:
   > `rules: users: - root@%:root - sharding@:sharding provider: type: ALL_PERMITTED
   > 
   > 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: false sql-show: true sql-simple: true check-table-metadata-enabled: false show-process-list-enabled: false proxy-backend-query-fetch-size: -1 check-duplicate-table-enabled: false proxy-frontend-executor-size: 0 proxy-backend-executor-suitable: OLAP proxy-frontend-max-connections: 0 sql-federation-enabled: false proxy-backend-driver-type: JDBC proxy-mysql-default-version: 5.7.22 proxy-default-port: 3307 proxy-netty-backlog: 1024 `
   > 
   > ### config-sharding.xml:
   > `databaseName: decard_pay_dev
   > 
   > dataSources: ds0: url: jdbc:mysql://127.0.0.1:3306/decard_pay_dev?serverTimezone=UTC&useSSL=false username: root password: root connectionTimeoutMilliseconds: 30000 idleTimeoutMilliseconds: 60000 maxLifetimeMilliseconds: 1800000 maxPoolSize: 50
   > 
   > rules: sharding: tables: dp_trade_payment_order: # 配置数据节点 actual-data-nodes: ds0.dp_trade_payment_order_$->{2020..2025}_0$->{1..4} # 分表策略 table-strategy: complex: sharding-columns: platform_order_no,order_time,pay_success_time sharding-algorithm-name: order-algorithm dp_trade_payment_record: # 配置数据节点 actual-data-nodes: ds0.dp_trade_payment_record_−>2020..20250->{1..4} # 分表策略 table-strategy: complex: sharding-columns: platform_order_no,pay_success_time sharding-algorithm-name: order-algorithm sharding-algorithms: order-algorithm: type: CLASS_BASED props: strategy: COMPLEX algorithmClassName: com.decard.sharding.config.OrderComplexKeysShardingAlgorithm binding-tables: dp_trade_payment_order,dp_trade_payment_record `
   
   finish


-- 
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] flyduckforever commented on issue #18759: sharing-proxy start error: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration

Posted by GitBox <gi...@apache.org>.
flyduckforever commented on issue #18759:
URL: https://github.com/apache/shardingsphere/issues/18759#issuecomment-1172862519

   finish


-- 
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] terrymanu commented on issue #18759: sharing-proxy start error: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.shardingsphere.infra.yaml.config.pojo.YamlRuleConfiguration

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #18759:
URL: https://github.com/apache/shardingsphere/issues/18759#issuecomment-1172864271

   What is hump mode, did you mean camel case?


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