Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find property 'tables' on class: org.apache.shardingsphere.single.yaml.config.pojo.YamlSingleRuleConfiguration #28331

Closed
zhangheng0027 opened this issue Sep 1, 2023 · 11 comments · Fixed by #28700

Comments

@zhangheng0027
Copy link

Rules can be run when using sharding,
But there was an error using SINGLE

spring:
  datasource:
    driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
    url: jdbc:shardingsphere:classpath:sharding.yaml

sharding.yaml

dataSources:
  master:
    dataSourceClassName: com.zaxxer.hikari.HikariDataSource
    driverClassName: com.mysql.cj.jdbc.Driver
    jdbcUrl: jdbc:mysql://localhost:3406/oee?serverTimezone=GMT%2B8&characterEncoding=utf8&useSSL=true
    username: 
    password: 

rules:
  - !SINGLE
    tables:
      # MySQL 风格
      - master.* # 加载指定数据源中的全部单表
    defaultDataSource: master
dataSources:
  master:
    dataSourceClassName: com.zaxxer.hikari.HikariDataSource
    driverClassName: com.mysql.cj.jdbc.Driver
    jdbcUrl: jdbc:mysql://localhost:3406/oee?serverTimezone=GMT%2B8&characterEncoding=utf8&useSSL=true
    username: 
    password: 


rules:
  - !SHARDING
    tables:
      equipment_oee:
        actualDataNodes: master.equipment_oee
        tableStrategy:
          complex:
            shardingColumns: statistics_cycle,statistics_time,serial_no
            shardingAlgorithmName: oeecyclealgorithmsharding

    shardingAlgorithms:
      oeecyclealgorithmsharding:
        type: CLASS_BASED
        props:
          strategy: complex
          algorithmClassName: com.kstopa.dataServer.system.conf.sharding.OeeCycleAlgorithmSharding

@linghengqian
Copy link
Member

  • Please provide an example of git. This looks like it needs to confirm the SnakeYAML version.

@zhangheng0027
Copy link
Author

  • Please provide an example of git. This looks like it needs to confirm the SnakeYAML version.

https://github.com/zhangheng0027/testSharding.git
com.example.testsharding.TestShardingApplicationTests#test01

Error will be reported upon startup

@linghengqian
Copy link
Member

@linghengqian
Copy link
Member

$ gradle clean test

> Task :compileJava
注: /home/linghengqian/TwinklingLiftWorks/git/public/testSharding/src/main/java/com/example/testsharding/OeeCycleAlgorithmSharding.java使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
2023-09-02T13:12:14.914+08:00  INFO 30345 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2023-09-02T13:12:14.920+08:00  INFO 30345 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.3/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD SUCCESSFUL in 46s
5 actionable tasks: 5 executed

@linghengqian linghengqian removed their assignment Sep 2, 2023
@zhangheng0027
Copy link
Author

  • 看来你没有提供SQL文件,我直接使用h2database重写了你的项目。我在linghengqian/testSharding@ 31549a8中没有看到这个错误。
  • 首先,SINGLE配置单表加载是ShardingSphere 5.4.0之后才提供的功能。没有 5.3.2。
  • 其次,您尚未为 Java EE 8 配置 JAXB 的任何实现,该实现记录在Spring Boot 文档中添加 Jakarta EE 命名空间的描述 #28303中。
  • 我不明白为什么你的./gradlew文件被篡改了 Unix 权限。看起来您是从另一个文件系统复制了 Gradle Wrapper 文件。

Changing the version to 5.4.0 will work fine, thanks

@zhangheng0027
Copy link
Author

  • 看来你没有提供SQL文件,我直接使用h2database重写了你的项目。我在linghengqian/testSharding@ 31549a8中没有看到这个错误。
  • 首先,SINGLE配置单表加载是ShardingSphere 5.4.0之后才提供的功能。没有 5.3.2。
  • 其次,您尚未为 Java EE 8 配置 JAXB 的任何实现,该实现记录在Spring Boot 文档中添加 Jakarta EE 命名空间的描述 #28303中。
  • 我不明白为什么你的./gradlew文件被篡改了 Unix 权限。看起来您是从另一个文件系统复制了 Gradle Wrapper 文件。

https://shardingsphere.apache.org/document/5.3.0/cn/overview/

I remember, the latest version of the document is not 5.4

@linghengqian linghengqian reopened this Sep 6, 2023
@linghengqian
Copy link
Member

I remember, the latest version of the document is not 5.4

@zhangheng0027
Copy link
Author

我记得文档最新版本不是5.4

No, but I hope to know the current version accurately.
The document I was looking at was the latest version, but when I couldn't determine my specific version, I thought 5.3.2 was the latest version。
image

@linghengqian
Copy link
Member

@github-actions
Copy link

github-actions bot commented Oct 6, 2023

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.

@github-actions github-actions bot added the stale label Oct 6, 2023
@linghengqian linghengqian removed the stale label Oct 9, 2023
@linghengqian linghengqian self-assigned this Oct 9, 2023
@linghengqian
Copy link
Member

  • I'm late because I've been busy in recent months. Fixing this issue seems to only require dealing with one Hugo configuration file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants