linghengqian opened a new issue, #22736: URL: https://github.com/apache/shardingsphere/issues/22736
## Bug Report **For English only**, other languages will not accept. Before report a bug, make sure you have: - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues). - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview). Please pay attention on issues you submitted, because we maybe need more details. If no response anymore and we cannot reproduce it on current information, we will **close it**. Please answer these questions before submitting your issue. Thanks! ### Which version of ShardingSphere did you use? - 5.2.1 ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy? - ShardingSphere-JDBC ### Expected behavior - SQL for logical tables is executed normally. ### Actual behavior - SQL for logical tables isnot executed normally. ```shell Caused by: java.lang.ClassCastException: class java.time.LocalDateTime cannot be cast to class java.lang.String (java.time.LocalDateTime and java.lang.String are in module java.base of loader 'bootstrap') at org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSet.getString(ShardingSphereResultSet.java:160) at com.zaxxer.hikari.pool.HikariProxyResultSet.getString(HikariProxyResultSet.java) at org.apache.ibatis.logging.jdbc.ResultSetLogger.printColumnValues(ResultSetLogger.java:111) at org.apache.ibatis.logging.jdbc.ResultSetLogger.invoke(ResultSetLogger.java:80) at jdk.proxy4/jdk.proxy4.$Proxy132.next(Unknown Source) at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValuesForSimpleResultMap(DefaultResultSetHandler.java:359) at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleRowValues(DefaultResultSetHandler.java:335) at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSet(DefaultResultSetHandler.java:308) at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:201) at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:65) at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151) ``` ### Reason analyze (If you can) - In the SpringBoot application, configuring `mybatis.configuration.log-impl` to `org.apache.ibatis.logging.stdout.StdOutImpl` will allow users to see the SQL Log. Correspondingly, in the `org.apache.ibatis.logging.jdbc.ResultSetLogger#printColumnValues` function, it will directly call the `getString` method of `java.sql.ResultSet`. -  - When ShardingSphere operates the real table, there is no problem in this step. But once the logical table of ShardingSphere JDBC is operated, `java.sql.ResultSet` is actually `org.apache.shardingsphere.driver.jdbc.core.resultset.ShardingSphereResultSet`, and its `getString` function will try to convert `java.time.LocalDateTime `Similar classes convert to `java.lang.String`, which is not possible to do directly. -  - Apparently, removing the configuration of `mybatis.configuration.log-impl` will solve this problem, but this should not be a reasonable option. -  ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc. - After ensuring Docker CLI is installed, execute the following command. Git at https://github.com/linghengqian/mybatis-stdout-shardingsphere-test . - The logical table test of the unit test fails, the real table test is fine. ```shell git clone [email protected]:linghengqian/mybatis-stdout-shardingsphere-test.git cd ./mybatis-stdout-shardingsphere-test/ sdk install java 22.3.r17-grl sdk use java 22.3.r17-grl ./gradlew clean test ``` ### Example codes for reproduce this issue (such as a github link). - Git at https://github.com/linghengqian/mybatis-stdout-shardingsphere-test - This is the real reason for https://github.com/apache/shardingsphere/issues/22451 . -- 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]
