apache / shardingsphere

Empowering Data Intelligence with Distributed SQL for Sharding, Scalability, and Security Across All Databases.
Apache License 2.0
19.94k stars 6.74k forks source link

CommunicationsException, jdbc cannot be used again or reconnected. need to restart the application #32350

Closed xcmonline closed 3 months ago

xcmonline commented 3 months ago

shardingsphere-jdbc 5.5.0 druid 1.2.23

application.yml

spring: main: allow-bean-definition-overriding: true datasource: driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver url: jdbc:shardingsphere:classpath:sharding.yaml

sharding.yaml

dataSources: master: dataSourceClassName: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver url: jdbc:mysql://127.0.0.1:33060/test?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&autoReconnect=true username: test password:

slave_1: dataSourceClassName: com.alibaba.druid.pool.DruidDataSource driverClassName: com.mysql.cj.jdbc.Driver url: jdbc:mysql://127.0.0.1:6033/test?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&autoReconnect=true username: test password:

error:

Creating a new SqlSession SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@928901c] was not registered for synchronization because synchronization is not active JDBC Connection [com.alibaba.druid.pool.DruidStatementConnection@316225f1] will not be managed by Spring ==> Preparing: INSERT INTO obs_data ( device_code, factor_code, observ_time, observ_val ) VALUES ( ?, ?, ?, ? ) ==> Parameters: 1001(String), TEM(String), 2024-08-01T10:37:04.895339300(LocalDateTime), 10.3(String) 2024-08-01 10:37:04.898 INFO 10428 --- [nio-8383-exec-6] ShardingSphere-SQL : Logic SQL: INSERT INTO obs_data ( device_code, factor_code, observ_time, observ_val ) VALUES ( ?, ?, ?, ? ) 2024-08-01 10:37:04.898 INFO 10428 --- [nio-8383-exec-6] ShardingSphere-SQL : Actual SQL: master ::: INSERT INTO obs_data_2024_8 ( device_code, factor_code, observ_time, observ_val ) VALUES (?, ?, ?, ?) ::: [1001, TEM, 2024-08-01T10:37:04.895339300, 10.3] 2024-08-01 10:37:04.908 ERROR 10428 --- [nio-8383-exec-6] c.a.druid.pool.DruidPooledStatement : CommunicationsException, druid version 1.2.23, jdbcUrl : jdbc:mysql://127.0.0.1:33060/test?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&autoReconnect=true, testWhileIdle true, idle millis 238175, minIdle 0, poolingCount 0, timeBetweenEvictionRunsMillis 60000, lastValidIdleMillis 238175, driver com.mysql.cj.jdbc.Driver, exceptionSorter com.alibaba.druid.pool.vendor.MySqlExceptionSorter 2024-08-01 10:37:04.943 ERROR 10428 --- [nio-8383-exec-6] com.alibaba.druid.pool.DruidDataSource : {conn-110006} discard

com.mysql.cj.jdbc.exceptions.CommunicationsException: The last packet successfully received from the server was 177,115 milliseconds ago. The last packet sent successfully to the server was 177,144 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:1364) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:1349) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ClientPreparedStatement.checkReadOnlySafeStatement(ClientPreparedStatement.java:291) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:301) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:483) ~[druid-1.2.23.jar:na] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement$2.executeSQL(ShardingSpherePreparedStatement.java:513) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement$2.executeSQL(ShardingSpherePreparedStatement.java:509) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:85) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:64) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.syncExecute(ExecutorEngine.java:99) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.parallelExecute(ExecutorEngine.java:95) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.execute(ExecutorEngine.java:78) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:66) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:50) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.executor.DriverJDBCExecutor.doExecute(DriverJDBCExecutor.java:148) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.executor.DriverJDBCExecutor.execute(DriverJDBCExecutor.java:139) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.useDriverToExecute(ShardingSpherePreparedStatement.java:502) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.executeWithExecutionContext(ShardingSpherePreparedStatement.java:456) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:432) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:483) ~[druid-1.2.23.jar:na] ... Caused by: com.mysql.cj.exceptions.CJCommunicationsException: The last packet successfully received from the server was 177,115 milliseconds ago. The last packet sent successfully to the server was 177,144 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na] at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[na:na] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[na:na] at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:104) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:149) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:165) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.readMessage(NativeProtocol.java:582) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:762) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.sendCommand(NativeProtocol.java:701) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.sendCommand(NativeProtocol.java:157) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.NativeSession.queryServerVariable(NativeSession.java:593) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:1356) ~[mysql-connector-j-8.3.0.jar:8.3.0] ... 98 common frames omitted Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.cj.protocol.FullReadInputStream.readFully(FullReadInputStream.java:67) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.SimplePacketReader.readHeaderLocal(SimplePacketReader.java:81) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:63) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:45) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.TimeTrackingPacketReader.readHeader(TimeTrackingPacketReader.java:52) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.TimeTrackingPacketReader.readHeader(TimeTrackingPacketReader.java:41) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.MultiPacketReader.readHeader(MultiPacketReader.java:54) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.MultiPacketReader.readHeader(MultiPacketReader.java:44) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.readMessage(NativeProtocol.java:576) ~[mysql-connector-j-8.3.0.jar:8.3.0] ... 103 common frames omitted

2024-08-01 10:37:04.945 ERROR 10428 --- [nio-8383-exec-6] c.a.druid.pool.DruidPooledStatement : CommunicationsException, druid version 1.2.23, jdbcUrl : jdbc:shardingsphere:classpath:sharding.yaml, testWhileIdle true, idle millis 177152, minIdle 0, poolingCount 7, timeBetweenEvictionRunsMillis 60000, lastValidIdleMillis 177152, driver org.apache.shardingsphere.driver.ShardingSphereDriver Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@928901c] 2024-08-01 10:37:05.025 WARN 10428 --- [nio-8383-exec-6] o.s.jdbc.support.SQLErrorCodesFactory : Error while extracting database name

org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: connection disabled at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:366) ~[spring-jdbc-5.3.31.jar:5.3.31] at org.springframework.jdbc.support.SQLErrorCodesFactory.resolveErrorCodes(SQLErrorCodesFactory.java:235) ~[spring-jdbc-5.3.31.jar:5.3.31] at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.lambda$setDataSource$0(SQLErrorCodeSQLExceptionTranslator.java:138) ~[spring-jdbc-5.3.31.jar:5.3.31] at org.springframework.util.function.SingletonSupplier.get(SingletonSupplier.java:97) ~[spring-core-5.3.31.jar:5.3.31] at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.setDataSource(SQLErrorCodeSQLExceptionTranslator.java:139) ~[spring-jdbc-5.3.31.jar:5.3.31] at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.(SQLErrorCodeSQLExceptionTranslator.java:100) ~[spring-jdbc-5.3.31.jar:5.3.31] at org.mybatis.spring.MyBatisExceptionTranslator.lambda$new$0(MyBatisExceptionTranslator.java:55) ~[mybatis-spring-2.1.2.jar:2.1.2] at org.mybatis.spring.MyBatisExceptionTranslator.initExceptionTranslator(MyBatisExceptionTranslator.java:107) ~[mybatis-spring-2.1.2.jar:2.1.2] at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:89) ~[mybatis-spring-2.1.2.jar:2.1.2] at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:439) ~[mybatis-spring-2.1.2.jar:2.1.2] at jdk.proxy2/jdk.proxy2.$Proxy92.insert(Unknown Source) ~[na:na] at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272) ~[mybatis-spring-2.1.2.jar:2.1.2] at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59) ~[mybatis-plus-core-3.5.7.jar:3.5.7] at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:152) ~[mybatis-plus-core-3.5.7.jar:3.5.7] at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89) ~[mybatis-plus-core-3.5.7.jar:3.5.7] at jdk.proxy4/jdk.proxy4.$Proxy100.insert(Unknown Source) ~[na:na] at com.baomidou.mybatisplus.extension.service.IService.save(IService.java:61) ~[mybatis-plus-extension-3.5.7.jar:3.5.7] at com.baomidou.mybatisplus.extension.service.IService$$FastClassBySpringCGLIB$$f8525d18.invoke() ~[mybatis-plus-extension-3.5.7.jar:na] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.31.jar:5.3.31] at org.springframework.aop.framework.CglibAopProxy.invokeMethod(CglibAopProxy.java:386) ~[spring-aop-5.3.31.jar:5.3.31] at org.springframework.aop.framework.CglibAopProxy.access$000(CglibAopProxy.java:85) ~[spring-aop-5.3.31.jar:5.3.31] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:703) ~[spring-aop-5.3.31.jar:5.3.31] ... Caused by: java.sql.SQLException: connection disabled at com.alibaba.druid.pool.DruidPooledConnection.checkStateInternal(DruidPooledConnection.java:1184) ~[druid-1.2.23.jar:na] at com.alibaba.druid.pool.DruidPooledConnection.checkState(DruidPooledConnection.java:1169) ~[druid-1.2.23.jar:na] at com.alibaba.druid.pool.DruidPooledConnection.getMetaData(DruidPooledConnection.java:890) ~[druid-1.2.23.jar:na] at org.apache.shardingsphere.driver.jdbc.core.datasource.metadata.ShardingSphereDatabaseMetaData.(ShardingSphereDatabaseMetaData.java:51) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.getMetaData(ShardingSphereConnection.java:89) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at com.alibaba.druid.pool.DruidStatementConnection.getMetaData(DruidStatementConnection.java:120) ~[druid-1.2.23.jar:na] at com.alibaba.druid.pool.DruidPooledConnection.getMetaData(DruidPooledConnection.java:896) ~[druid-1.2.23.jar:na] at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:340) ~[spring-jdbc-5.3.31.jar:5.3.31] ... 72 common frames omitted Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: The last packet successfully received from the server was 177,115 milliseconds ago. The last packet sent successfully to the server was 177,144 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:1364) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:1349) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ClientPreparedStatement.checkReadOnlySafeStatement(ClientPreparedStatement.java:291) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:301) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:483) ~[druid-1.2.23.jar:na] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement$2.executeSQL(ShardingSpherePreparedStatement.java:513) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement$2.executeSQL(ShardingSpherePreparedStatement.java:509) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:85) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:64) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.syncExecute(ExecutorEngine.java:99) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.parallelExecute(ExecutorEngine.java:95) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.execute(ExecutorEngine.java:78) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:66) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:50) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.executor.DriverJDBCExecutor.doExecute(DriverJDBCExecutor.java:148) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.executor.DriverJDBCExecutor.execute(DriverJDBCExecutor.java:139) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.useDriverToExecute(ShardingSpherePreparedStatement.java:502) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.executeWithExecutionContext(ShardingSpherePreparedStatement.java:456) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:432) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:483) ~[druid-1.2.23.jar:na] ... 63 common frames omitted Caused by: com.mysql.cj.exceptions.CJCommunicationsException: The last packet successfully received from the server was 177,115 milliseconds ago. The last packet sent successfully to the server was 177,144 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na] at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[na:na] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[na:na] at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:104) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:149) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:165) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.readMessage(NativeProtocol.java:582) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:762) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.sendCommand(NativeProtocol.java:701) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.sendCommand(NativeProtocol.java:157) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.NativeSession.queryServerVariable(NativeSession.java:593) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:1356) ~[mysql-connector-j-8.3.0.jar:8.3.0] ... 98 common frames omitted Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.cj.protocol.FullReadInputStream.readFully(FullReadInputStream.java:67) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.SimplePacketReader.readHeaderLocal(SimplePacketReader.java:81) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:63) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:45) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.TimeTrackingPacketReader.readHeader(TimeTrackingPacketReader.java:52) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.TimeTrackingPacketReader.readHeader(TimeTrackingPacketReader.java:41) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.MultiPacketReader.readHeader(MultiPacketReader.java:54) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.MultiPacketReader.readHeader(MultiPacketReader.java:44) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.readMessage(NativeProtocol.java:576) ~[mysql-connector-j-8.3.0.jar:8.3.0] ... 103 common frames omitted

2024-08-01 10:37:05.035 WARN 10428 --- [nio-8383-exec-6] o.s.jdbc.support.SQLErrorCodesFactory : Error while extracting database name

org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is java.sql.SQLException: connection disabled at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:366) ~[spring-jdbc-5.3.31.jar:5.3.31] at org.springframework.jdbc.support.SQLErrorCodesFactory.resolveErrorCodes(SQLErrorCodesFactory.java:235) ~[spring-jdbc-5.3.31.jar:5.3.31] at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.lambda$setDataSource$0(SQLErrorCodeSQLExceptionTranslator.java:138) ~[spring-jdbc-5.3.31.jar:5.3.31] at org.springframework.util.function.SingletonSupplier.get(SingletonSupplier.java:97) ~[spring-core-5.3.31.jar:5.3.31] at org.springframework.util.function.SupplierUtils.resolve(SupplierUtils.java:40) ~[spring-core-5.3.31.jar:5.3.31] at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.getSqlErrorCodes(SQLErrorCodeSQLExceptionTranslator.java:169) ~[spring-jdbc-5.3.31.jar:5.3.31] at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:191) ~[spring-jdbc-5.3.31.jar:5.3.31] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73) ~[spring-jdbc-5.3.31.jar:5.3.31] at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92) ~[mybatis-spring-2.1.2.jar:2.1.2] at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:439) ~[mybatis-spring-2.1.2.jar:2.1.2] at jdk.proxy2/jdk.proxy2.$Proxy92.insert(Unknown Source) ~[na:na] at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272) ~[mybatis-spring-2.1.2.jar:2.1.2] at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59) ~[mybatis-plus-core-3.5.7.jar:3.5.7] at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:152) ~[mybatis-plus-core-3.5.7.jar:3.5.7] at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89) ~[mybatis-plus-core-3.5.7.jar:3.5.7] at jdk.proxy4/jdk.proxy4.$Proxy100.insert(Unknown Source) ~[na:na] at com.baomidou.mybatisplus.extension.service.IService.save(IService.java:61) ~[mybatis-plus-extension-3.5.7.jar:3.5.7] at com.baomidou.mybatisplus.extension.service.IService$$FastClassBySpringCGLIB$$f8525d18.invoke() ~[mybatis-plus-extension-3.5.7.jar:na] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.31.jar:5.3.31] at org.springframework.aop.framework.CglibAopProxy.invokeMethod(CglibAopProxy.java:386) ~[spring-aop-5.3.31.jar:5.3.31] at org.springframework.aop.framework.CglibAopProxy.access$000(CglibAopProxy.java:85) ~[spring-aop-5.3.31.jar:5.3.31] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:703) ~[spring-aop-5.3.31.jar:5.3.31] at com.test.iot.domain.service.impl.ObsDataServiceImpl$$EnhancerBySpringCGLIB$$c376c1aa.save() ~[classes/:na] at com.test.iot.server.controller.TestController.test(TestController.java:45) ~[classes/:na] at jdk.internal.reflect.GeneratedMethodAccessor107.invoke(Unknown Source) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-5.3.31.jar:5.3.31] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150) ~[spring-web-5.3.31.jar:5.3.31] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-5.3.31.jar:5.3.31] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.3.31.jar:5.3.31] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808) ~[spring-webmvc-5.3.31.jar:5.3.31] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.3.31.jar:5.3.31] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1072) ~[spring-webmvc-5.3.31.jar:5.3.31] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:965) ~[spring-webmvc-5.3.31.jar:5.3.31] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) ~[spring-webmvc-5.3.31.jar:5.3.31] at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) ~[spring-webmvc-5.3.31.jar:5.3.31] ... Caused by: java.sql.SQLException: connection disabled at com.alibaba.druid.pool.DruidPooledConnection.checkStateInternal(DruidPooledConnection.java:1184) ~[druid-1.2.23.jar:na] at com.alibaba.druid.pool.DruidPooledConnection.checkState(DruidPooledConnection.java:1169) ~[druid-1.2.23.jar:na] at com.alibaba.druid.pool.DruidPooledConnection.getMetaData(DruidPooledConnection.java:890) ~[druid-1.2.23.jar:na] at org.apache.shardingsphere.driver.jdbc.core.datasource.metadata.ShardingSphereDatabaseMetaData.(ShardingSphereDatabaseMetaData.java:51) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.getMetaData(ShardingSphereConnection.java:89) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at com.alibaba.druid.pool.DruidStatementConnection.getMetaData(DruidStatementConnection.java:120) ~[druid-1.2.23.jar:na] at com.alibaba.druid.pool.DruidPooledConnection.getMetaData(DruidPooledConnection.java:896) ~[druid-1.2.23.jar:na] at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:340) ~[spring-jdbc-5.3.31.jar:5.3.31] ... 72 common frames omitted Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: The last packet successfully received from the server was 177,115 milliseconds ago. The last packet sent successfully to the server was 177,144 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:1364) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:1349) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ClientPreparedStatement.checkReadOnlySafeStatement(ClientPreparedStatement.java:291) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:301) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:483) ~[druid-1.2.23.jar:na] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement$2.executeSQL(ShardingSpherePreparedStatement.java:513) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement$2.executeSQL(ShardingSpherePreparedStatement.java:509) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:85) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:64) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.syncExecute(ExecutorEngine.java:99) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.parallelExecute(ExecutorEngine.java:95) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.execute(ExecutorEngine.java:78) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:66) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:50) ~[shardingsphere-infra-executor-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.executor.DriverJDBCExecutor.doExecute(DriverJDBCExecutor.java:148) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.executor.DriverJDBCExecutor.execute(DriverJDBCExecutor.java:139) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.useDriverToExecute(ShardingSpherePreparedStatement.java:502) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.executeWithExecutionContext(ShardingSpherePreparedStatement.java:456) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:432) ~[shardingsphere-jdbc-5.5.0.jar:5.5.0] at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:483) ~[druid-1.2.23.jar:na] ... 63 common frames omitted Caused by: com.mysql.cj.exceptions.CJCommunicationsException: The last packet successfully received from the server was 177,115 milliseconds ago. The last packet sent successfully to the server was 177,144 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na] at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[na:na] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[na:na] at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:104) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:149) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:165) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.readMessage(NativeProtocol.java:582) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.checkErrorMessage(NativeProtocol.java:762) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.sendCommand(NativeProtocol.java:701) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.sendCommand(NativeProtocol.java:157) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.NativeSession.queryServerVariable(NativeSession.java:593) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.jdbc.ConnectionImpl.isReadOnly(ConnectionImpl.java:1356) ~[mysql-connector-j-8.3.0.jar:8.3.0] ... 98 common frames omitted Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.cj.protocol.FullReadInputStream.readFully(FullReadInputStream.java:67) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.SimplePacketReader.readHeaderLocal(SimplePacketReader.java:81) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:63) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.SimplePacketReader.readHeader(SimplePacketReader.java:45) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.TimeTrackingPacketReader.readHeader(TimeTrackingPacketReader.java:52) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.TimeTrackingPacketReader.readHeader(TimeTrackingPacketReader.java:41) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.MultiPacketReader.readHeader(MultiPacketReader.java:54) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.MultiPacketReader.readHeader(MultiPacketReader.java:44) ~[mysql-connector-j-8.3.0.jar:8.3.0] at com.mysql.cj.protocol.a.NativeProtocol.readMessage(NativeProtocol.java:576) ~[mysql-connector-j-8.3.0.jar:8.3.0] ... 103 common frames omitted

terrymanu commented 3 months ago

The issue involves other third-party dependencies, but our focus is solely on ShardingSphere itself. Since ShardingSphere implements the JDBC interface, standard applications should be functional. We wish to allocate more effort towards enhancing the current version, and therefore will no longer handle such issues. Please read the documentation or provide more effective information when submitting an issue.