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 2022/01/04 08:36:51 UTC
[GitHub] [shardingsphere] eschh19 opened a new issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
eschh19 opened a new issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375
Caused by: java.lang.IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
at org.apache.shardingsphere.infra.yaml.engine.constructor.ShardingSphereYamlConstructor.getClassForName(ShardingSphereYamlConstructor.java:60) ~[shardingsphere-infra-common-5.0.0.jar:5.0.0]
at org.yaml.snakeyaml.constructor.Constructor.getClassForNode(Constructor.java:662) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.getConstructor(Constructor.java:322) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:331) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:219) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:479) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:190) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:460) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:158) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:219) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.newInstance(Constructor.java:305) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:268) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:171) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:331) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:219) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:173) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:157) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:472) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:438) ~[snakeyaml-1.26.jar:?]
at org.apache.shardingsphere.infra.yaml.engine.YamlEngine.unmarshal(YamlEngine.java:56) ~[shardingsphere-infra-common-5.0.0.jar:5.0.0]
at org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:60) ~[shardingsphere-jdbc-core-5.0.0.jar:5.0.0]
Which version of ShardingSphere did you use?
shardingsphere-jdbc:5.0.0
Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
Expected behavior
project started successfully
Actual behavior
Caused by: java.lang.IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
at org.apache.shardingsphere.infra.yaml.engine.constructor.ShardingSphereYamlConstructor.getClassForName(ShardingSphereYamlConstructor.java:60) ~[shardingsphere-infra-common-5.0.0.jar:5.0.0]
at org.yaml.snakeyaml.constructor.Constructor.getClassForNode(Constructor.java:662) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.getConstructor(Constructor.java:322) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:331) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:219) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:479) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:190) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:460) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:158) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:219) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.newInstance(Constructor.java:305) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.constructJavaBean2ndStep(Constructor.java:268) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructMapping.construct(Constructor.java:171) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.Constructor$ConstructYamlObject.construct(Constructor.java:331) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:230) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:219) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.constructDocument(BaseConstructor.java:173) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.constructor.BaseConstructor.getSingleData(BaseConstructor.java:157) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.Yaml.loadFromReader(Yaml.java:472) ~[snakeyaml-1.26.jar:?]
at org.yaml.snakeyaml.Yaml.loadAs(Yaml.java:438) ~[snakeyaml-1.26.jar:?]
at org.apache.shardingsphere.infra.yaml.engine.YamlEngine.unmarshal(YamlEngine.java:56) ~[shardingsphere-infra-common-5.0.0.jar:5.0.0]
at org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:60) ~[shardingsphere-jdbc-core-5.0.0.jar:5.0.0]
Reason analyze (If you can)
when I use shardingsphere-jdbc:5.0.0-alpha, it worked well, but when I change version to shardingsphere-jdbc:5.0.0, it doesn't work.
I traced code, shardingsphere-jdbc:5.0.0's ShardingSphereYamlConstructor class has "getClassForName" override method, shardingsphere-jdbc:5.0.0-alpha's ShardingSphereYamlConstructor class not have this method,
this method rootClass.getName() always is "org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration", but className is "com.alibaba.druid.pool.DruidDataSource", so it throw Class is not accepted:" exception.
my configuration
dataSources:
ds0: !!com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://xxxxxxxxxxx/xxxxxxxxxxx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&statementInterceptors=com.oppo.trace.mysql.TraceStatementInterceptor,com.oppo.browser.common.next.executor.NextStatementInterceptor
username: xxxxxxx
password: xxxxxxx
ds1: !!com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.jdbc.Driver
url: jdbc:mysql://xxxxxxxxxxx/xxxxxxxxxxx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&statementInterceptors=com.oppo.trace.mysql.TraceStatementInterceptor,com.oppo.browser.common.next.executor.NextStatementInterceptor
username: xxxxxxx
password: xxxxxxx
<bean id="file_master" class="org.springframework.util.ResourceUtils" factory-method="getFile">
<constructor-arg name="resourceLocation" value="classpath:master_jdbc.yaml" />
</bean>
<bean id="ds_master" class="org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory"
factory-method="createDataSource" destroy-method="close">
<constructor-arg ref="file_master" />
</bean>
--
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] NOLouser commented on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
NOLouser commented on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1003895708
@eschh19
Hi, If you use YamlShardingSphereDataSourceFactory to create dataSource, you can refer to this configuration (Or take a look at my demo: [https://github.com/NOLouser/shardingsphere5.0.0_demo/blob/master/src/main/resources/shardingsphere.yml](https://github.com/NOLouser/shardingsphere5.0.0_demo/blob/master/src/main/resources/shardingsphere.yml) ):
```
# 配置真实数据源
dataSources:
# 配置第 1 个数据源
ds:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
jdbcUrl: jdbc:mysql://localhost:3306/month_ds?useUnicode=true&characterEncoding=utf-8&useSSL=false
username: root
password: 123456
```
And If you use springboot application.yml, please refer to @zjcnb example.
--
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] eschh19 commented on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
eschh19 commented on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1004616455
> > > @eschh19 Hi, If you use YamlShardingSphereDataSourceFactory to create dataSource, you can refer to this configuration (Or take a look at my demo: https://github.com/NOLouser/shardingsphere5.0.0_demo/blob/master/src/main/resources/shardingsphere.yml ):
> > > ```
> > > # 配置真实数据源
> > > dataSources:
> > > # 配置第 1 个数据源
> > > ds:
> > > dataSourceClassName: com.zaxxer.hikari.HikariDataSource
> > > driverClassName: com.mysql.cj.jdbc.Driver
> > > jdbcUrl: jdbc:mysql://localhost:3306/month_ds?useUnicode=true&characterEncoding=utf-8&useSSL=false
> > > username: root
> > > password: 123456
> > > ```
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > And If you use springboot application.yml, please refer to @zjcnb example.
> >
> >
> > I really use YamlShardingSphereDataSourceFactory to create dataSource,and change config to yours is OK,but your Official Website's example is incorrect,please modify it (◠‿◠)。
--
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] eschh19 commented on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
eschh19 commented on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1004618780
I also have a question with ShardingSphere, when start application,it always print warn message like
"WARN [2022-01-04 16:35:21,406] [Socket-Request] c.o.b.h.c.u.ConfigUtils.warn(Logger.java:86) - parse yaml file content error : Can't construct a java object for !SHARDING; exception=Invalid tag: !SHARDING
in 'reader', line 62, column 3:
- !SHARDING
^"
I want to know it's normal or not, and how to fix it.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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] eschh19 commented on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
eschh19 commented on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1004614753
> @eschh19 Hi, If you use YamlShardingSphereDataSourceFactory to create dataSource, you can refer to this configuration (Or take a look at my demo: https://github.com/NOLouser/shardingsphere5.0.0_demo/blob/master/src/main/resources/shardingsphere.yml ):
>
> ```
> # 配置真实数据源
> dataSources:
> # 配置第 1 个数据源
> ds:
> dataSourceClassName: com.zaxxer.hikari.HikariDataSource
> driverClassName: com.mysql.cj.jdbc.Driver
> jdbcUrl: jdbc:mysql://localhost:3306/month_ds?useUnicode=true&characterEncoding=utf-8&useSSL=false
> username: root
> password: 123456
> ```
>
> And If you use springboot application.yml, please refer to @zjcnb example.
I really use YamlShardingSphereDataSourceFactory to create dataSource,and change config to yours is OK,but your Official Website's example is incorrect,please modify it (◠‿◠)。
--
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] zjcnb commented on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1004627382
@eschh19 Where is the official document wrong, is it convenient to point it out?
--
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] zjcnb commented on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1004713949
> > > I also have a question with ShardingSphere, when start application,it always print warn message like "WARN [2022-01-04 16:35:21,406] [Socket-Request] c.o.b.h.c.u.ConfigUtils.warn(Logger.java:86) - parse yaml file content error : Can't construct a java object for !SHARDING; exception=Invalid tag: !SHARDING in 'reader', line 62, column 3: - !SHARDING ^" I want to know it's normal or not, and how to fix it.thanks.
> >
> >
> > Maybe, your yaml config format not right. You can check it.
>
> https://shardingsphere.apache.org/document/5.0.0/en/user-manual/shardingsphere-jdbc/usage/sharding/yaml/ this example datasource config like “ds0: !!com.zaxxer.hikari.HikariDataSource” it will print this warn message.
This problem are fixed. refer to : https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/data-source/
--
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] zjcnb commented on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1004628011
> I also have a question with ShardingSphere, when start application,it always print warn message like "WARN [2022-01-04 16:35:21,406] [Socket-Request] c.o.b.h.c.u.ConfigUtils.warn(Logger.java:86) - parse yaml file content error : Can't construct a java object for !SHARDING; exception=Invalid tag: !SHARDING in 'reader', line 62, column 3: - !SHARDING ^" I want to know it's normal or not, and how to fix it.thanks.
Maybe, your yaml config format not right. You can check it.
--
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] zjcnb commented on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1001954927
@eschh19 Hi, you can refer to this configuration:
```
ds-1:
jdbc-url: jdbc:mysql://127.0.0.1:13307/demo_primary_ds?serverTimezone=UTC&useSSL=false
username: root
password: 123456
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
connectionTimeoutMilliseconds: 3000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
```
--
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] zjcnb commented on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1002027670
Please refer to : https://github.com/zjcnb/shardingsphere-all-feature-demo/blob/origin/shardingsphere-sharding-db-table-demo/src/main/resources/application.yml
--
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] eschh19 commented on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
eschh19 commented on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1004616074
> > @eschh19 Hi, If you use YamlShardingSphereDataSourceFactory to create dataSource, you can refer to this configuration (Or take a look at my demo: https://github.com/NOLouser/shardingsphere5.0.0_demo/blob/master/src/main/resources/shardingsphere.yml ):
> > ```
> > # 配置真实数据源
> > dataSources:
> > # 配置第 1 个数据源
> > ds:
> > dataSourceClassName: com.zaxxer.hikari.HikariDataSource
> > driverClassName: com.mysql.cj.jdbc.Driver
> > jdbcUrl: jdbc:mysql://localhost:3306/month_ds?useUnicode=true&characterEncoding=utf-8&useSSL=false
> > username: root
> > password: 123456
> > ```
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > And If you use springboot application.yml, please refer to @zjcnb example.
>
> I really use YamlShardingSphereDataSourceFactory to create dataSource,and change config to yours is OK,but your Official Website's example is incorrect,please modify it (◠‿◠)。
--
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] eschh19 closed issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
eschh19 closed issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375
--
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] eschh19 commented on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
eschh19 commented on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1004630393
> @eschh19 Where is the official document wrong, is it convenient to point it out?
https://shardingsphere.apache.org/document/5.0.0/en/user-manual/shardingsphere-jdbc/usage/sharding/yaml/
I refer to this example to config my yaml,it don't have 'dataSourceClassName' property.
--
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] eschh19 commented on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
eschh19 commented on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1002021073
> @eschh19 Hi, you can refer to this configuration:
>
> ```
> spring:
> shardingsphere:
> props:
> sql-show: true
> datasource:
> ds-0:
> jdbc-url: jdbc:mysql://127.0.0.1:13306/demo_primary_ds?serverTimezone=UTC&useSSL=false
> username: root
> password: 123456
> type: com.zaxxer.hikari.HikariDataSource
> driver-class-name: com.mysql.cj.jdbc.Driver
> connectionTimeoutMilliseconds: 3000
> idleTimeoutMilliseconds: 60000
> maxLifetimeMilliseconds: 1800000
> maxPoolSize: 50
> minPoolSize: 1
> ```
I change the yaml config:
dataSources:
ds0: !!com.alibaba.druid.pool.DruidDataSource
to:
dataSources:
ds0:
type: com.alibaba.druid.pool.DruidDataSource
,
it throw exception as below:
Caused by: java.lang.IllegalStateException: dataSourceClassName can not be null.
at com.google.common.base.Preconditions.checkState(Preconditions.java:589) ~[guava-29.0-jre.jar:?]
at org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigurationSwapper.swapToDataSourceConfiguration(YamlDataSourceConfigurationSwapper.java:54) ~[shardingsphere-infra-common-5.0.0.jar:5.0.0]
at org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigurationSwapper.lambda$swapToDataSources$0(YamlDataSourceConfigurationSwapper.java:44) ~[shardingsphere-infra-common-5.0.0.jar:5.0.0]
at java.util.stream.Collectors.lambda$toMap$172(Collectors.java:1321) ~[?:1.8.0_73]
at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[?:1.8.0_73]
at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:1.8.0_73]
--
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] zjcnb edited a comment on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
zjcnb edited a comment on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1001954927
@eschh19 Hi, you can refer to this configuration:
```
spring:
shardingsphere:
props:
sql-show: true
datasource:
ds-0:
jdbc-url: jdbc:mysql://127.0.0.1:13306/demo_primary_ds?serverTimezone=UTC&useSSL=false
username: root
password: 123456
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
connectionTimeoutMilliseconds: 3000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
```
--
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] eschh19 commented on issue #14375: shardingsphere-jdbc.5.0.0:IllegalArgumentException: Class is not accepted: com.alibaba.druid.pool.DruidDataSource
Posted by GitBox <gi...@apache.org>.
eschh19 commented on issue #14375:
URL: https://github.com/apache/shardingsphere/issues/14375#issuecomment-1004631791
> > I also have a question with ShardingSphere, when start application,it always print warn message like "WARN [2022-01-04 16:35:21,406] [Socket-Request] c.o.b.h.c.u.ConfigUtils.warn(Logger.java:86) - parse yaml file content error : Can't construct a java object for !SHARDING; exception=Invalid tag: !SHARDING in 'reader', line 62, column 3: - !SHARDING ^" I want to know it's normal or not, and how to fix it.thanks.
>
> Maybe, your yaml config format not right. You can check it.
https://shardingsphere.apache.org/document/5.0.0/en/user-manual/shardingsphere-jdbc/usage/sharding/yaml/
this example datasource config like
“ds0: !!com.zaxxer.hikari.HikariDataSource”
it will print this warn message.
--
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