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 2020/05/20 06:47:49 UTC
[GitHub] [shardingsphere] gfYaya opened a new issue #5700: What's the matter with this configuration in my 'yml' suffix file?
gfYaya opened a new issue #5700:
URL: https://github.com/apache/shardingsphere/issues/5700
I build my sharding-jdbc project according to this page:https://shardingsphere.apache.org/document/current/cn/manual/shardingsphere-jdbc/configuration/config-spring-boot/ .
It's only effective in the 'properties' suffix configuration file, and the console prints these exception info as the project with a 'yml' suffix configuration file.
Exception info:
2020-05-20 14:16:01.114 [main] INFO com.alibaba.druid.pool.DruidDataSource -
{dataSource-1} inited
2020-05-20 14:16:01.132 [Druid-ConnectionPool-Create-730935981] ERROR com.alibaba.druid.pool.DruidDataSource -
create connection SQLException, url: null, errorCode 0, state 08001
java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: The database URL cannot be null.
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:79)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:131)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:219)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1596)
at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1662)
at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2601)
Caused by: com.mysql.cj.exceptions.UnableToConnectException: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: The database URL cannot be null.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
... 4 common frames omitted
Caused by: com.mysql.cj.exceptions.WrongArgumentException: The database URL cannot be null.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.conf.ConnectionUrlParser.isConnectionStringSupported(ConnectionUrlParser.java:149)
at com.mysql.cj.conf.ConnectionUrl.acceptsUrl(ConnectionUrl.java:258)
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:187)
... 3 common frames omitted
The same exception printed recursively.
This is my 'yml' configuration:
spring:
#spring sharding jdbc 配置
shardingsphere:
datasource:
names: dataaudit
dataaudit:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.jdbc.Driver
jdbc-url: jdbc:mysql://rm-uf6hnc20q03xba0l0ao.mysql.rds.aliyuncs.com:3306/jiaanpei_dataudit?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
username: uatroot
password: Jiaanpei123Uat
sharding:
tables:
# janpb_goods_supp_standard_snapshot表分片策略
janpb_goods_supp_standard_snapshot:
table-strategy:
inline:
# 根据companyCode 进行分片
sharding-column: companyCode
algorithm-expression: dataaudit.janpb_goods_supp_standard_snapshot_$->{companyCode % 32}
###分表的总数 0到31 janpb_goods_supp_standard_snapshot_0, .... janpb_goods_supp_standard_snapshot_31
actual-data-nodes: dataaudit.janpb_goods_supp_standard_snapshot_$->{0..31}
props:
sql:
### 开启分片日志
show: true
I have tried to config that:
'type: !!com.alibaba.druid.pool.DruidDataSource ' with double excalmatory marks instead of 'type: com.alibaba.druid.pool.DruidDataSource' according to the https://shardingsphere.apache.org/document/current/cn/manual/shardingsphere-jdbc/configuration/config-yaml/, I failed again.
So, how to correct my 'yml' configurations.
Thank you very much.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] gfYaya commented on issue #5700: What's the matter with this configuration in my 'yml' suffix file?
Posted by GitBox <gi...@apache.org>.
gfYaya commented on issue #5700:
URL: https://github.com/apache/shardingsphere/issues/5700#issuecomment-631282266

----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] gfYaya edited a comment on issue #5700: What's the matter with this configuration in my 'yml' suffix file?
Posted by GitBox <gi...@apache.org>.
gfYaya edited a comment on issue #5700:
URL: https://github.com/apache/shardingsphere/issues/5700#issuecomment-631273798

----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] gfYaya commented on issue #5700: What's the matter with this configuration in my 'yml' suffix file?
Posted by GitBox <gi...@apache.org>.
gfYaya commented on issue #5700:
URL: https://github.com/apache/shardingsphere/issues/5700#issuecomment-631847505
> remove druid-spring-boot-starter and try again.
It does not work...
emmm.
I guess, the matter is in the Sharding-jdbc datasource proxy.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] gfYaya commented on issue #5700: What's the matter with this configuration in my 'yml' suffix file?
Posted by GitBox <gi...@apache.org>.
gfYaya commented on issue #5700:
URL: https://github.com/apache/shardingsphere/issues/5700#issuecomment-631273798

----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] gfYaya closed issue #5700: What's the matter with this configuration in my 'yml' suffix file?
Posted by GitBox <gi...@apache.org>.
gfYaya closed issue #5700:
URL: https://github.com/apache/shardingsphere/issues/5700
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] gfYaya commented on issue #5700: What's the matter with this configuration in my 'yml' suffix file?
Posted by GitBox <gi...@apache.org>.
gfYaya commented on issue #5700:
URL: https://github.com/apache/shardingsphere/issues/5700#issuecomment-631281189

----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] kimmking commented on issue #5700: What's the matter with this configuration in my 'yml' suffix file?
Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5700:
URL: https://github.com/apache/shardingsphere/issues/5700#issuecomment-631306277
remove druid-spring-boot-starter and try again.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] gfYaya removed a comment on issue #5700: What's the matter with this configuration in my 'yml' suffix file?
Posted by GitBox <gi...@apache.org>.
gfYaya removed a comment on issue #5700:
URL: https://github.com/apache/shardingsphere/issues/5700#issuecomment-631273798

----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] gfYaya commented on issue #5700: What's the matter with this configuration in my 'yml' suffix file?
Posted by GitBox <gi...@apache.org>.
gfYaya commented on issue #5700:
URL: https://github.com/apache/shardingsphere/issues/5700#issuecomment-631944914
Thank your for your help.I find the matter.It's jar confict,though I don't know the reason.
thanks.
----------------------------------------------------------------
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:
users@infra.apache.org
[GitHub] [shardingsphere] gfYaya removed a comment on issue #5700: What's the matter with this configuration in my 'yml' suffix file?
Posted by GitBox <gi...@apache.org>.
gfYaya removed a comment on issue #5700:
URL: https://github.com/apache/shardingsphere/issues/5700#issuecomment-631281189

----------------------------------------------------------------
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:
users@infra.apache.org