本帖最后由 君忆 于 2021-7-26 22:15 编辑
经常产生这种报错
java.sql.SQLException: No operations allowed after statement closed. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:82)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1020)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
at me.zhanshi123.vipsystem.data.Database.getAllFunctions(Database.java:391)
at me.zhanshi123.vipsystem.task.CheckAllTask.run(CheckAllTask.java:14)
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:100)
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54)
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:831)
Caused by: com.mysql.cj.exceptions.StatementIsClosedException: No operations allowed after statement closed.
at jdk.internal.reflect.GeneratedConstructorAccessor203.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
at com.mysql.cj.jdbc.StatementImpl.checkClosed(StatementImpl.java:338)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:958)
... 10 more
然后玩家登陆的时候 签到插件每次都连接数据库失败产生报错
然后又自动重连成功 每次都失败 然后重连
[!] 数据库数据读取失败, 发生错误:
The last packet successfully received from the server was 318,646 milliseconds ago. The last packet sent successfully to the server was 318,649 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.
Exception in thread "AsyncPlayerJoinThread" java.lang.NullPointerException: Cannot invoke "java.sql.ResultSet.next()" because "rs" is null
at studio.trc.bukkit.litesignin.database.MySQLStorage.isExist(MySQLStorage.java:546)
at studio.trc.bukkit.litesignin.database.MySQLStorage.register(MySQLStorage.java:553)
at studio.trc.bukkit.litesignin.database.MySQLStorage.<init>(MySQLStorage.java:62)
at studio.trc.bukkit.litesignin.database.MySQLStorage.getPlayerData(MySQLStorage.java:520)
at studio.trc.bukkit.litesignin.api.Storage.getPlayer(Storage.java:165)
at studio.trc.bukkit.litesignin.event.Join.lambda$onJoin$0(Join.java:41)
at java.base/java.lang.Thread.run(Thread.java:831)
[!] 成功修复 MySQL 服务器的连接.
经常产生这种报错
java.sql.SQLException: No operations allowed after statement closed. at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:82)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1020)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeQuery(ProxyPreparedStatement.java:52)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeQuery(HikariProxyPreparedStatement.java)
at me.zhanshi123.vipsystem.data.Database.getAllFunctions(Database.java:391)
at me.zhanshi123.vipsystem.task.CheckAllTask.run(CheckAllTask.java:14)
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftTask.run(CraftTask.java:100)
at org.bukkit.craftbukkit.v1_17_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54)
at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at java.base/java.lang.Thread.run(Thread.java:831)
Caused by: com.mysql.cj.exceptions.StatementIsClosedException: No operations allowed after statement closed.
at jdk.internal.reflect.GeneratedConstructorAccessor203.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
at com.mysql.cj.jdbc.StatementImpl.checkClosed(StatementImpl.java:338)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:958)
... 10 more
然后玩家登陆的时候 签到插件每次都连接数据库失败产生报错
然后又自动重连成功 每次都失败 然后重连
[!] 数据库数据读取失败, 发生错误:
The last packet successfully received from the server was 318,646 milliseconds ago. The last packet sent successfully to the server was 318,649 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.
Exception in thread "AsyncPlayerJoinThread" java.lang.NullPointerException: Cannot invoke "java.sql.ResultSet.next()" because "rs" is null
at studio.trc.bukkit.litesignin.database.MySQLStorage.isExist(MySQLStorage.java:546)
at studio.trc.bukkit.litesignin.database.MySQLStorage.register(MySQLStorage.java:553)
at studio.trc.bukkit.litesignin.database.MySQLStorage.<init>(MySQLStorage.java:62)
at studio.trc.bukkit.litesignin.database.MySQLStorage.getPlayerData(MySQLStorage.java:520)
at studio.trc.bukkit.litesignin.api.Storage.getPlayer(Storage.java:165)
at studio.trc.bukkit.litesignin.event.Join.lambda$onJoin$0(Join.java:41)
at java.base/java.lang.Thread.run(Thread.java:831)
[!] 成功修复 MySQL 服务器的连接.
都是数据库问题吧 或许你可以检查数据库配置 或者删除有问题的数据库文件重新生成