apache / apache/shardingsphere
use example shardingsphere-jdbc-example-generator generator codes error and running fail
- Dominant language
- Java
- Stars
- 20.8k
- Forks
- 6.9k
- Avg merge
- 11h 38m
- Merged PRs (30d)
- 326
Description
## Bug Report
**For English only**, other languages will not accept.
Before report a bug, make sure you have:
- Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
- Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will **close it**.
Please answer these questions before submitting your issue. Thanks!
### Which version of ShardingSphere did you use?
5.5.3-SNAPSHOT
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
### Expected behavior
use offical example module shardingsphere-jdbc-example-generator generator codes success and run generator codes success
### Actual behavior
1. generator codes fail
2. running fail
### Reason analyze (If you can)
1. codes generator with freemark template「pom.ftl」,<#if mode?contains("standalone") && repository == "JDBC">,I think maybe 「config.yaml」missing 「repository」properties
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
1. run generator main file :org.apache.shardingsphere.example.generator.ExampleGeneratorMain,
get error
「FreeMarker template error:
The following has evaluated to null or missing:
==> repository [in template "pom.ftl" at line 41, column 41]
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
FTL stack trace ("~" means nesting-related):
- Failed at: #if mode?contains("standalone") && re... [in template "pom.ftl" at line 41, column 5]
」
2. run ExampleMain get error:
org.apache.shardingsphere.infra.spi.exception.ServiceProviderNotFoundException: SPI-00001: No implementation class load from SPI 'org.apache.shardingsphere.infra.yaml.config.swapper.mode.YamlPersistRepositoryConfigurationSwapper' with type 'Standalone'.
### Example codes for reproduce this issue (such as a github link).
This is my local generator config 「shardingsphere-jdbc-example-generator config.yaml」
1. modes : standalone
2. transactions:local
3. features:sharding
4. frameworks:spring-boot-starter-mybatis
Other attributes have not been modified.
Contributor guide
Research direction
Start with org.apache.shardingsphere.example.generator.ExampleGeneratorMain and the shardingsphere-jdbc-example-generator config.yaml, then inspect pom.ftl at line 41 for the missing repository value. Reproduce the generator failure, then run ExampleMain and investigate the reported Standalone SPI error. Done means the configured standalone example generates successfully and runs without either exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- databases, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100