chenchen1008 opened a new issue #10190:
URL: https://github.com/apache/shardingsphere/issues/10190
## Bug Report
### Which version of ShardingSphere did you use?
`
<dependency>
<groupId>org.apache.shardingsphere</groupId>
<artifactId>shardingsphere-sharding-spring-boot-starter</artifactId>
<version>5.0.0-alpha</version>
</dependency>
`
### ShardingSphere-JDBC
### Actual behavior
`
org.springframework.beans.factory.BeanDefinitionStoreException: Failed to
process import candidates for configuration class
[com.nio.uad.live.Application]; nested exception is
java.lang.IllegalStateException: Could not evaluate condition on
org.apache.shardingsphere.sharding.spring.boot.ShardingRuleSpringBootConfiguration
due to org/apache/shardingsphere/spring/boot/util/PropertyUtil not found. Make
sure your own configuration does not rely on that class. This can also happen
if you are @ComponentScanning a springframework package (e.g. if you put a
@ComponentScan in the default package by mistake)
at
org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:610)
at
org.springframework.context.annotation.ConfigurationClassParser.access$800(ConfigurationClassParser.java:111)
at
org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.lambda$processGroupImports$1(ConfigurationClassParser.java:812)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at
org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorGroupingHandler.processGroupImports(ConfigurationClassParser.java:809)
at
org.springframework.context.annotation.ConfigurationClassParser$DeferredImportSelectorHandler.process(ConfigurationClassParser.java:780)
at
org.springframework.context.annotation.ConfigurationClassParser.parse(ConfigurationClassParser.java:193)
at
org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:331)
at
org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:247)
at
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:311)
at
org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:112)
at
org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564)
at
org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144)
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:769)
at
org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761)
at
org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:326)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1313)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1302)
at com.nio.uad.live.Application.main(Application.java:10)
Caused by: java.lang.IllegalStateException: Could not evaluate condition on
org.apache.shardingsphere.sharding.spring.boot.ShardingRuleSpringBootConfiguration
due to org/apache/shardingsphere/spring/boot/util/PropertyUtil not found. Make
sure your own configuration does not rely on that class. This can also happen
if you are @ComponentScanning a springframework package (e.g. if you put a
@ComponentScan in the default package by mistake)
at
org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:54)
at
org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108)
at
org.springframework.context.annotation.ConfigurationClassParser.processConfigurationClass(ConfigurationClassParser.java:226)
at
org.springframework.context.annotation.ConfigurationClassParser.processImports(ConfigurationClassParser.java:600)
... 20 common frames omitted
Caused by: java.lang.NoClassDefFoundError:
org/apache/shardingsphere/spring/boot/util/PropertyUtil
at
org.apache.shardingsphere.sharding.spring.boot.condition.ShardingSpringBootCondition.getMatchOutcome(ShardingSpringBootCondition.java:35)
at
org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
... 23 common frames omitted
Caused by: java.lang.ClassNotFoundException:
org.apache.shardingsphere.spring.boot.util.PropertyUtil
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 25 common frames omitted
`
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
run springboot
### my config.
`
spring.shardingsphere.datasource.names=write_ds,read_ds_0
spring.shardingsphere.datasource.write_ds.jdbc-url=jdbc:mariadb://xxx.com:3306/lifestyle_dev
spring.shardingsphere.datasource.write_ds.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.write_ds.driver-class-name=org.mariadb.jdbc.Driver
spring.shardingsphere.datasource.write_ds.username=root
spring.shardingsphere.datasource.write_ds.password=xxx
spring.shardingsphere.datasource.read_ds_0.jdbc-url=jdbc:mariadb://xxx.com:3306/lifestyle_dev
spring.shardingsphere.datasource.read_ds_0.type=com.zaxxer.hikari.HikariDataSource
spring.shardingsphere.datasource.read_ds_0.driver-class-name=org.mariadb.jdbc.Driver
spring.shardingsphere.datasource.read_ds_0.username=root
spring.shardingsphere.datasource.read_ds_0.password=xxx
spring.shardingsphere.rules.read-write-splitting.load-balancers.round_robin.type=ROUND_ROBIN
spring.shardingsphere.rules.read-write-splitting.data-sources.pr_ds.write-data-source-name=write_ds
spring.shardingsphere.rules.read-write-splitting.data-sources.pr_ds.read-data-source-names=read_ds_0
spring.shardingsphere.rules.read-write-splitting.data-sources.pr_ds.load-balancer-name=round_robin
`
--
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]