zhaolu-ai opened a new issue, #34747:
URL: https://github.com/apache/shardingsphere/issues/34747

   ## Bug Report
   
   ### Which version of ShardingSphere did you use?
   ```xml
   <dependency>
       <groupId>org.apache.shardingsphere</groupId>
       <artifactId>shardingsphere-jdbc-core-spring-boot-starter</artifactId>
       <version>5.1.1</version>
   </dependency>
   ```
   
   ### Which project did you use?
   ShardingSphere-JDBC
   
   ### Expected behavior
   - Successful startup in all environments (local IDEA, `java -jar`, Jenkins).
   
   **Behavior patterns in different environments**:
   1. Local IDEA: ✅ No error
   2. `java -jar`: ❌ Occasional failures
   3. Jenkins pipeline (online deployment environment):
      - First deployment: ✅ Success
      - Access sharding-related pages: ❌ Failures (high frequency)
      - After rebuild: ✅ Temporary resolution
   
   ### Actual behavior
   **Intermittent startup failures on the test line** with the error message 
`Cannot support database type 'MySQL'`:
   ```
   Caused by: java.lang.IllegalArgumentException: Cannot support database type 
'MySQL'
        ... 217 more
        at 
org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:90)
        at 
org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:88)
        at com.sun.proxy.$Proxy850.prepareStatement(Unknown Source)
        at 
org.apache.ibatis.logging.jdbc.ConnectionLogger.invoke(ConnectionLogger.java:53)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at jdk.internal.reflect.GeneratedMethodAccessor110.invoke(Unknown 
Source)
        at 
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(ShardingSphereConnection.java:80)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:149)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:180)
        at 
org.apache.shardingsphere.infra.parser.ShardingSphereSQLParserEngine.parse(ShardingSphereSQLParserEngine.java:58)
        at 
org.apache.shardingsphere.infra.parser.sql.SQLStatementParserEngine.parse(SQLStatementParserEngine.java:47)
        at 
com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5031)
        at 
com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5024)
        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4042)
        at com.google.common.cache.LocalCache.get(LocalCache.java:4019)
        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2087)
   Caused by: com.google.common.util.concurrent.UncheckedExecutionException: 
java.lang.IllegalArgumentException: Cannot support database type 'MySQL'
        ... 180 more
        at 
org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:425)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at jdk.internal.reflect.GeneratedMethodAccessor167.invoke(Unknown 
Source)
        at 
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:142)
        at 
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
        at 
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:154)
        at com.sun.proxy.$Proxy808.query(Unknown Source)
        at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:59)
        at 
com.github.yulichang.interceptor.MPJInterceptor.intercept(MPJInterceptor.java:77)
        at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at jdk.internal.reflect.GeneratedMethodAccessor117.invoke(Unknown 
Source)
        at com.sun.proxy.$Proxy808.query(Unknown Source)
        at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:59)
        at 
com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:81)
        at 
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:110)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:158)
        at 
org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:333)
        at 
org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:64)
        at 
org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:90)
        at com.sun.proxy.$Proxy809.prepare(Unknown Source)
        at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:59)
        at 
cn.iocoder.yudao.module.system.aop.MetaObjectHandlerInterceptor.intercept(MetaObjectHandlerInterceptor.java:30)
        at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at jdk.internal.reflect.GeneratedMethodAccessor111.invoke(Unknown 
Source)
        at com.sun.proxy.$Proxy809.prepare(Unknown Source)
        at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:59)
        at 
com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:106)
        at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at jdk.internal.reflect.GeneratedMethodAccessor111.invoke(Unknown 
Source)
        at 
org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:60)
        at 
org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:99)
   Caused by: org.apache.ibatis.executor.ExecutorException: Error preparing 
statement.  Cause: 
com.google.common.util.concurrent.UncheckedExecutionException: 
java.lang.IllegalArgumentException: Cannot support database type 'MySQL'
        at java.base/java.lang.Thread.run(Thread.java:955)
   ```
   
   ### Attempted Solutions
   | Solution | Result |
   |----------|--------|
   | Upgrade to version 5.2.1 | Failed: `snakeyaml` dependency conflict → other 
conflicts emerged |
   | Pre-register SQL parser configuration 
(`NewInstanceServiceLoader.register`) | Failed: Related classes are unavailable 
in version 5.1.1 |
   | Specify `database-type: MySQL` configuration | No improvement |
   | Refer to #7701, #7947 | No effective solution found |
   
   ### Key Observations
   1. **Suspicious issues in the dependency tree**  
      Evidence of conflict:
      ```
      Caused by: com.google.common.util.concurrent.UncheckedExecutionException
      at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2087)
      ```
      - There may be a Guava version conflict affecting cache loading.
   
   2. **Environment-sensitive behavior**  
      It works fine in the local IDE but fails in the packaged JAR file, 
indicating that:
      - The build process may introduce dependency conflicts.
   
   3. **MyBatis integration situation**  
      The error occurs during the statement preparation phase:
      ```java
      at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(...)
      ```
   
   ### Reproduction Steps
   1. It cannot be reproduced locally and occurs occasionally (frequently) on 
Jenkins.
   2. Deploy the built artifact to the server.
   3. Access the sharding-related API endpoint:
      ```http
      GET /admin-api/common/parking-place/queryParkingPlaceList
      ```
   4. Observe the error message in the logs (reproduction rate is about 80%).
   
   ### Related Links
   - Similar unresolved issue: 
[#7947](https://github.com/apache/shardingsphere/issues/7947)
   - Reference for attempted solutions: 
[#7701](https://github.com/apache/shardingsphere/issues/7701)
   ---
   
   ### Possibly affected dependency versions
   ```java
           
<druid-spring-boot-starter.version>1.2.20</druid-spring-boot-starter.version>
           
<mybatis-plus-boot-starter.version>3.5.4</mybatis-plus-boot-starter.version>
        <mysql.version>8.0.33</mysql.version>
           
<mybatis-plus-generator.version>3.5.4</mybatis-plus-generator.version>
           
<dynamic-datasource-spring-boot-starter.version>4.3.1</dynamic-datasource-spring-boot-starter.version>
           <mybatis-plus-join.version>1.4.7</mybatis-plus-join.version>
           <shardingsphere.version>5.1.1</shardingsphere.version>
           <redisson.version>3.18.0</redisson.version>
           <dm8.jdbc.version>8.1.3.62</dm8.jdbc.version>
           <guava.version>32.1.3-jre</guava.version>
   ```


-- 
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: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to