You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "ywy2090 (via GitHub)" <gi...@apache.org> on 2023/08/15 03:32:31 UTC
[GitHub] [shardingsphere] ywy2090 opened a new issue, #28086: Unable to find property 'spring' on class: org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfiguration
ywy2090 opened a new issue, #28086:
URL: https://github.com/apache/shardingsphere/issues/28086
配置项:
shardingsphere.yaml
`
# JDBC 逻辑库名称。在集群模式中,使用该参数来联通 ShardingSphere-JDBC 与 ShardingSphere-Proxy。
spring:
shardingsphere:
datasource:
names: druid # 数据源名字
druid:
type: com.alibaba.druid.pool.DruidDataSource # 连接池
url: jdbc:mysql://127.0.0.1:3306/sharding_sphere?serverTimezone=GMT%2B8&characterEncoding=UTF-8&connectTimeout=60000&socketTimeout=60000&allowMultiQueries=true&useSSL=false # 主库地址
username: root # 主库用户名
password: 123456 # 主库密码
rules:
- !ENCRYPT
tables:
t_user:
columns:
username:
cipherColumn: username
encryptorName: name_encryptor
likeQueryColumn: name_like
likeQueryEncryptorName: like_encryptor
encryptors:
like_encryptor:
type: CHAR_DIGEST_LIKE
name_encryptor:
type: AES
props:
aes-key-value: 123456abc
`
spring-boot:
`
# 配置 DataSource Driver
spring.datasource.driver-class-name=org.apache.shardingsphere.driver.ShardingSphereDriver
# 指定 YAML 配置文件
spring.datasource.url=jdbc:shardingsphere:classpath:shardingsphere.yaml
`
依赖配置:
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2'
implementation 'org.apache.shardingsphere:shardingsphere-jdbc-core:5.4.0'
启动报错:
`
Caused by: org.yaml.snakeyaml.error.YAMLException: Unable to find property 'spring' on class: org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfiguration
at org.yaml.snakeyaml.TypeDescription.getProperty(TypeDescription.java:228) ~[snakeyaml-1.33.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:262) ~[snakeyaml-1.33.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:207) ~[snakeyaml-1.33.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:358) ~[snakeyaml-1.33.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:270) ~[snakeyaml-1.33.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:253) ~[snakeyaml-1.33.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:207) ~[snakeyaml-1.33.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:191) ~[snakeyaml-1.33.jar:?]
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:477) ~[snakeyaml-1.33.jar:?]
at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:470) ~[snakeyaml-1.33.jar:?]
at org.apache.shardingsphere.infra.util.yaml.YamlEngine.unmarshal(YamlEngine.java:69) ~[shardingsphere-infra-util-5.4.0.jar:5.4.0]
at org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:101) ~[shardingsphere-jdbc-core-5.4.0.jar:5.4.0]
at org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.createDataSource(DriverDataSourceCache.java:51) ~[shardingsphere-jdbc-core-5.4.0.jar:5.4.0]
at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[?:1.8.0_152]
at org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.get(DriverDataSourceCache.java:45) ~[shardingsphere-jdbc-core-5.4.0.jar:5.4.0]
at org.apache.shardingsphere.driver.ShardingSphereDriver.connect(ShardingSphereDriver.java:51) ~[shardingsphere-jdbc-core-5.4.0.jar:5.4.0]
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:121) ~[HikariCP-4.0.3.jar:?]
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:364) ~[HikariCP-4.0.3.jar:?]
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-4.0.3.jar:?]
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:476) ~[HikariCP-4.0.3.jar:?]
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:561) ~[HikariCP-4.0.3.jar:?]
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-4.0.3.jar:?]
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-4.0.3.jar:?]
at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:160) ~[spring-jdbc-5.3.29.jar:5.3.29]
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:118) ~[spring-jdbc-5.3.29.jar:5.3.29]
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:81) ~[spring-jdbc-5.3.29.jar:5.3.29]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:332) ~[spring-jdbc-5.3.29.jar:5.3.29]
at org.springframework.boot.jdbc.EmbeddedDatabaseConnection.isEmbedded(EmbeddedDatabaseConnection.java:164) ~[spring-boot-2.7.14.jar:2.7.14]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateDefaultDdlAutoProvider.getDefaultDdlAuto(HibernateDefaultDdlAutoProvider.java:42) ~[spring-boot-autoconfigure-2.7.14.jar:2.7.14]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.lambda$getVendorProperties$1(HibernateJpaConfiguration.java:130) ~[spring-boot-autoconfigure-2.7.14.jar:2.7.14]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateSettings.getDdlAuto(HibernateSettings.java:41) ~[spring-boot-autoconfigure-2.7.14.jar:2.7.14]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties.determineDdlAuto(HibernateProperties.java:143) ~[spring-boot-autoconfigure-2.7.14.jar:2.7.14]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties.getAdditionalProperties(HibernateProperties.java:103) ~[spring-boot-autoconfigure-2.7.14.jar:2.7.14]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties.determineHibernateProperties(HibernateProperties.java:95) ~[spring-boot-autoconfigure-2.7.14.jar:2.7.14]
at org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration.getVendorProperties(HibernateJpaConfiguration.java:131) ~[spring-boot-autoconfigure-2.7.14.jar:2.7.14]
at org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.entityManagerFactory(JpaBaseConfiguration.java:132) ~[spring-boot-autoconfigure-2.7.14.jar:2.7.14]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_152]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_152]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.29.jar:5.3.29]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.29.jar:5.3.29]
... 18 more
`
--
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] ywy2090 closed issue #28086: Unable to find property 'spring' on class: org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfiguration
Posted by "ywy2090 (via GitHub)" <gi...@apache.org>.
ywy2090 closed issue #28086: Unable to find property 'spring' on class: org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfiguration
URL: https://github.com/apache/shardingsphere/issues/28086
--
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] ywy2090 commented on issue #28086: Unable to find property 'spring' on class: org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfiguration
Posted by "ywy2090 (via GitHub)" <gi...@apache.org>.
ywy2090 commented on issue #28086:
URL: https://github.com/apache/shardingsphere/issues/28086#issuecomment-1678489461
ok thanks. My config items is copy from other web site, not official。
--
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] zhaojinchao95 commented on issue #28086: Unable to find property 'spring' on class: org.apache.shardingsphere.driver.api.yaml.YamlJDBCConfiguration
Posted by "zhaojinchao95 (via GitHub)" <gi...@apache.org>.
zhaojinchao95 commented on issue #28086:
URL: https://github.com/apache/shardingsphere/issues/28086#issuecomment-1678477460
Your datasource configuration has some mistakes, refer to :
```
dataSources:
ds_0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName:
jdbcUrl:
username:
password:
ds_1:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName:
jdbcUrl:
username:
password:
```
--
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