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/09/20 03:12:53 UTC

[GitHub] [shardingsphere] hyz1994121 opened a new issue, #21083: shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception;

hyz1994121 opened a new issue, #21083:
URL: https://github.com/apache/shardingsphere/issues/21083

   
   
   shardingsphere-jdbc-core-spring-namespace version old 5.1.1 to new 5.2.0
   project start, i got error logs, 
   Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception; nested exception is Can't construct a java object for tag:yaml.org,2002:com.alibaba.druid.filter.stat.StatFilter; exception=Class is not accepted: com.alibaba.druid.filter.stat.StatFilter in 'string', line 76, column 5: - !!com.alibaba.druid.filter.stat. ... ^
   
   start project by debug 
   i got the ymal content like this 
   
   dataSource:
     connectionErrorRetryAttempts: 1
     initGlobalVariants: false
     notEmptyWaitNanos: 0
     executeUpdateCount: 0
     mbeanRegistered: false
     failContinuous: false
     initExceptionThrow: true
     dupCloseLogEnable: false
     logAbandoned: false
     password: XXX
     maxIdle: 8
     removeAbandoned: false
     cachedPreparedStatementDeleteCount: 0
     enable: true
     rawDriverMajorVersion: -1
     discardCount: 0
     initVariants: false
     errorCount: 0
     transactionThresholdMillis: 0
     createTimespanMillis: 0
     minIdle: 3
     destroyCount: 0
     asyncCloseConnectionEnable: false
     connectErrorCount: 0
     notFullTimeoutRetryCount: 0
     notEmptyWaitMillis: 0
     breakAfterAcquireFailure: false
     cachedPreparedStatementMissCount: 0
     notEmptySignalCount: 0
     version: 1.2.4
     onFatalErrorMaxActive: 0
     sharePreparedStatements: false
     rawDriverMinorVersion: -1
     driverMajorVersion: -1
     maxEvictableIdleTimeMillis: 25200000
     rawJdbcUrl: JDBC-URL
     phyTimeoutMillis: -1
     killWhenSocketReadTimeout: false
     useGlobalDataSourceStat: false
     onFatalError: false
     checkExecuteTime: false
     waitThreadCount: 0
     startTransactionCount: 0
     poolPreparedStatements: false
     phyMaxUseCount: -1
     maxOpenPreparedStatements: 10
     rollbackCount: 0
     closedPreparedStatementCount: 0
     recycleErrorCount: 0
     removeAbandonedCount: 0
     lastCreateErrorTimeMillis: 0
     preparedStatementCount: 0
     activeCount: 0
     keepAliveBetweenTimeMillis: 120000
     keepAlive: false
     closeCount: 0
     url: JDBC-URL
     transactionQueryTimeout: 0
     testOnBorrow: false
     createCount: 0
     minEvictableIdleTimeMillis: 300000
     timeBetweenEvictionRunsMillis: 10000
     testOnReturn: false
     closed: false
     maxActive: 20
     notEmptyWaitThreadCount: 0
     dupCloseCount: 0
     resetCount: 0
     commitCount: 0
     maxPoolPreparedStatementPerConnectionSize: 10
     testWhileIdle: true
     andResetExecuteCount: 0
     dataSourceClassName: com.alibaba.druid.pool.DruidDataSource
     proxyFilters:
     - !!com.alibaba.druid.filter.stat.StatFilter
       connectionStackTraceEnable: false
       logSlowSql: false
       mergeSql: false
       slowSqlMillis: 3000
     asyncInit: false
     resetStatEnable: true
     notEmptyWaitCount: 0
     cachedPreparedStatementCount: 0
     oracle: false
     maxWait: 60000
     cachedPreparedStatementAccessCount: 0
     executeCount: 0
     failFast: false
     recycleCount: 0
     clearFiltersEnable: true
     name: DataSource-882144085
     executeCount2: 0
     maxCreateTaskCount: 3
     validationQueryTimeout: -1
     full: false
     queryTimeout: 0
     poolingPeak: 0
     validationQuery: SELECT 'x'
     inited: false
     useOracleImplicitCache: true
     lastErrorTimeMillis: 0
     createErrorCount: 0
     maxWaitThreadCount: -1
     connectCount: 0
     notEmptyWaitThreadPeak: 0
     cachedPreparedStatementHitCount: 0
     filterClassNames:
     - com.alibaba.druid.filter.stat.StatFilter
     useUnfairLock: false
     activePeak: 0
     logDifferentThread: true
     removeAbandonedTimeout: 300
     defaultAutoCommit: true
     poolingCount: 0
     createTimespanNano: 0
     timeBetweenConnectErrorMillis: 500
     timeBetweenLogStatsMillis: 0
     initialSize: 6
     removeAbandonedTimeoutMillis: 300000
     executeQueryCount: 0
     lockQueueLength: 0
     executeBatchCount: 0
     numTestsPerEvictionRun: 3
     accessToUnderlyingConnectionAllowed: true
     driverMinorVersion: -1
     iD: 0
     properties: '{}'
     useLocalSessionState: true
     username: username
   
   excption on this
   org.apache.shardingsphere.infra.util.yaml.constructor.ShardingSphereYamlConstructor#getClassForName 
           throw new IllegalArgumentException(String.format("Class is not accepted: %s", className));
   
   the exception is , rootClass is java.lang.HashMap
   but the className is com.alibaba.druid.filter.stat.StatFilter
   is there some bugs? or i need to update my configs?
   
   <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
           <property name="driverClassName" value="${dataSource.driver}"/>
           <property name="url" value="${dataSource.url}"/>
           <property name="username" value="${dataSource.username}"/>
           <property name="password" value="${dataSource.password}"/>
           <property name="filters" value="stat"/>
           <property name="maxActive" value="${dataSource.maxActive}"/>
           <property name="initialSize" value="${dataSource.initialSize}"/>
           <property name="maxWait" value="60000"/>
           <property name="minIdle" value="3"/>
           <property name="timeBetweenEvictionRunsMillis" value="10000"/>
           <property name="minEvictableIdleTimeMillis" value="300000"/>
           <property name="validationQuery" value="SELECT 'x'"/>
           <property name="testWhileIdle" value="true"/>
           <property name="testOnBorrow" value="false"/>
           <property name="testOnReturn" value="false"/>
       </bean>
   
    <shardingsphere:data-source id="druidDataSource" data-source-names="dataSource" rule-refs="shardingRule">
           <props>
               <prop key="sql-show">false</prop>
           </props>
       </shardingsphere:data-source>
   
   this is my spring-name-space xml config
   
   
   升级到5.2.0版本以后启动报错,debug后发现解析类出错
   
   
   


-- 
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] linghengqian commented on issue #21083: shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception;

Posted by GitBox <gi...@apache.org>.
linghengqian commented on issue #21083:
URL: https://github.com/apache/shardingsphere/issues/21083#issuecomment-1258186056

   @caol64 
   - The useless cold knowledge in my mind has increased, Gradle 6.6 is not compatible with JDK 17. 🤣
   - I debugged for a while and couldn't find a PR that affects this factor. Would you mind opening a new issue? the description of this issue are not conducive to search, I think friends who added strong validation to metadata before will notice this problem.


-- 
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] linghengqian commented on issue #21083: shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception;

Posted by GitBox <gi...@apache.org>.
linghengqian commented on issue #21083:
URL: https://github.com/apache/shardingsphere/issues/21083#issuecomment-1253165125

   - I tested using `com.alibaba:druid:1.2.12`.  For Alibaba Druid's plugin, you need to use its Java API to configure it.  
   
   - I can tell you that Alibaba Druid's Spring Boot Starter is **inherently buggy** and **under-maintained** for a long time, which brings a lot of unknown behavior and you need to steer clear of its Spring Boot Starter.  Refer to https://github.com/alibaba/druid/issues/4673.
   
   - The title and description of this issue are confusing, I suggest you use the issue template to open a new issue.  Then close this issue and give a link to the new issue for discussion.


-- 
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] hyz1994121 commented on issue #21083: shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception;

Posted by GitBox <gi...@apache.org>.
hyz1994121 commented on issue #21083:
URL: https://github.com/apache/shardingsphere/issues/21083#issuecomment-1253343270

   > * I tested using `com.alibaba:druid:1.2.12`.  For Alibaba Druid's plugin, you need to use its Java API to configure it.
   > * I can tell you that Alibaba Druid's Spring Boot Starter is **inherently buggy** and **under-maintained** for a long time, which brings a lot of unknown behavior and you need to steer clear of its Spring Boot Starter.  Refer to [Auto-Configuration should expose explicit datasource type, not interface alibaba/druid#4673](https://github.com/alibaba/druid/issues/4673).
   > * The title and description of this issue are confusing, I suggest you use the issue template to open a new issue.  Then close this issue and give a link to the new issue for discussion.
   
   okok, i will open a new issue,then close this one
   on my project ,i used Alibaba Druid by xml, not Spring Boot Starter, not JAVA API
   i will try by Java api for some test.
   thank you .
   


-- 
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


Re: [I] shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception; [shardingsphere]

Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian commented on issue #21083:
URL: https://github.com/apache/shardingsphere/issues/21083#issuecomment-1932128483

   - Verify that this issue has been resolved at https://github.com/apache/shardingsphere/issues/21211#issuecomment-1932123528 . 
   - Since there are no relevant unit tests for the current issue for a long time, I will close this issue.


-- 
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] linghengqian commented on issue #21083: shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception;

Posted by GitBox <gi...@apache.org>.
linghengqian commented on issue #21083:
URL: https://github.com/apache/shardingsphere/issues/21083#issuecomment-1253487479

   - For ShardingSphere 5.2.0 using SnakeYAML 1.30, there is a YAML deserialization bug first discovered in ShardingSphere that broke a unit test of ShardingSphere a few months ago, and was fixed not long ago at https://github.com/apache/shardingsphere/pull/21048.  
   
   - This seems to be a duplicate of https://github.com/apache/shardingsphere/issues/21032#issuecomment-1250017446 for the unique handling of Alibaba Druid, because unit tests for Alibaba Druid never existed for ShardingSphere, which led to no discovery  Possible issues with `org.apache.shardingsphere.infra.util.yaml.constructor.ShardingSphereYamlConstructor`.  
   
   - But anyway, it's impossible for anyone to know what's going on without anyone willing to provide an 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


Re: [I] shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception; [shardingsphere]

Posted by "linghengqian (via GitHub)" <gi...@apache.org>.
linghengqian closed issue #21083: shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception; 
URL: https://github.com/apache/shardingsphere/issues/21083


-- 
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] linghengqian commented on issue #21083: shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception;

Posted by GitBox <gi...@apache.org>.
linghengqian commented on issue #21083:
URL: https://github.com/apache/shardingsphere/issues/21083#issuecomment-1253135080

   - I suggest you use **```** to format the syntax part of your markdown, and fill in the reproduction steps through the issue template.  
   
   - At the same time you need to provide a git repository pointing to a minimal reproducible example using h2database.  The configuration you provided is incomplete, and I tested it locally without any problems.


-- 
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] caol64 commented on issue #21083: shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception;

Posted by GitBox <gi...@apache.org>.
caol64 commented on issue #21083:
URL: https://github.com/apache/shardingsphere/issues/21083#issuecomment-1257490798

   > * For ShardingSphere 5.2.0 using SnakeYAML 1.30, there is a YAML deserialization bug first discovered in ShardingSphere that broke a unit test of ShardingSphere a few months ago, and was fixed not long ago at [Update snakeyaml to 1.32 to fix yaml deserialization problem #21048](https://github.com/apache/shardingsphere/pull/21048).
   > * This seems to be a duplicate of [shardingsphere5.2 cannot use druid with Password encryption #21032 (comment)](https://github.com/apache/shardingsphere/issues/21032#issuecomment-1250017446) for the unique handling of Alibaba Druid, because unit tests for Alibaba Druid never existed for ShardingSphere, which led to no discovery  Possible issues with `org.apache.shardingsphere.infra.util.yaml.constructor.ShardingSphereYamlConstructor`.
   > * But anyway, it's impossible for anyone to know what's going on without anyone willing to provide an example.🤔
   
   @linghengqian I provide an example: https://github.com/caol64/sharding-test. In version 5.2, It will throw an exception: Can't construct a java object for tag:yaml.org,2002:com.alibaba.druid.filter.stat.StatFilter; exception=Class is not accepted: com.alibaba.druid.filter.stat.StatFilter. Please check.


-- 
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] hyz1994121 commented on issue #21083: shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception;

Posted by GitBox <gi...@apache.org>.
hyz1994121 commented on issue #21083:
URL: https://github.com/apache/shardingsphere/issues/21083#issuecomment-1253158432

   > * I suggest you use double **```** to format the syntax part of your markdown, and fill in the reproduction steps through the issue template.
   > * At the same time you need to provide a git repository pointing to a minimal reproducible example using h2database.  The configuration you provided is incomplete, and I tested it locally without any problems.
   
   do you use the alibaba.druid for datasource?
   which version do you use druid ?
   


-- 
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] caol64 commented on issue #21083: shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception;

Posted by GitBox <gi...@apache.org>.
caol64 commented on issue #21083:
URL: https://github.com/apache/shardingsphere/issues/21083#issuecomment-1258853335

   @linghengqian Thank you, I have opened an issue https://github.com/apache/shardingsphere/issues/21211.


-- 
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] hyz1994121 commented on issue #21083: shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception;

Posted by GitBox <gi...@apache.org>.
hyz1994121 commented on issue #21083:
URL: https://github.com/apache/shardingsphere/issues/21083#issuecomment-1253129670

   is there anyone can help me?


-- 
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] hyz1994121 commented on issue #21083: shardingsphere 5.2 version, Failed to instantiate [org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource]: Constructor threw exception;

Posted by GitBox <gi...@apache.org>.
hyz1994121 commented on issue #21083:
URL: https://github.com/apache/shardingsphere/issues/21083#issuecomment-1253434996

   > * I tested using `com.alibaba:druid:1.2.12`.  For Alibaba Druid's plugin, you need to use its Java API to configure it.
   > * I can tell you that Alibaba Druid's Spring Boot Starter is **inherently buggy** and **under-maintained** for a long time, which brings a lot of unknown behavior and you need to steer clear of its Spring Boot Starter.  Refer to [Auto-Configuration should expose explicit datasource type, not interface alibaba/druid#4673](https://github.com/alibaba/druid/issues/4673).
   > * The title and description of this issue are confusing, I suggest you use the issue template to open a new issue.  Then close this issue and give a link to the new issue for discussion.
   
   thank you , i change my config from xml to Java API, and upgrade my mysql-connector-java version 5.1.7 to 8.0.14
   then my project start.
   but there still some bugs, like i described before, error happend by srping beans xml config
   when i got some more time , i will make a new issue 
   
   spring配置文件使用xml形式启动会出错, 用@Configuration注解后解决问题
   debug发现问题出现在snake-yaml,配置文件导入后解析ymal-content ,解析过程写死了classtype为Map.class,无法解析内部的自定义类别


-- 
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