mysql出现Connection.close() has already been called. Invalid operation in this state.

今天上服务器发现tomcat 里面报如下错误 但是网站并没有挂 后来找了原来

16-Nov-2016 11:43:08.437 警告 [http-nio-8989-exec-5] com.mchange.v2.c3p0.impl.NewPooledConnection.handleThrowable [c3p0] A PooledConnection that has already signalled a Connection error is still in use!

16-Nov-2016 11:43:08.437 警告 [http-nio-8989-exec-5] com.mchange.v2.c3p0.impl.NewPooledConnection.handleThrowable [c3p0] Another error has occurred [ com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection.close() has already been called. Invalid operation in this state. ] which will not be reported to listeners!
 com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Connection.close() has already been called. Invalid operation in this state.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.ConnectionImpl.getMutex(ConnectionImpl.java:3032)

at com.mysql.jdbc.ConnectionImpl.rollback(ConnectionImpl.java:4606)


原来是数据库连接被关闭了,网上找一下可以通过设置wait_timeout来解决。

我查了下

mysql出现Connection.close() has already been called. Invalid operation in this state._第1张图片

默认是28800 然而我服务器上却不是

mysql出现Connection.close() has already been called. Invalid operation in this state._第2张图片

查了下这么小肯定要报错啊

使用命令加大设置即可

mysql出现Connection.close() has already been called. Invalid operation in this state._第3张图片



mysql> set global wait_timeout=28800;
Query OK, 0 rows affected
mysql> show global variables like 'wait_timeout';

然后就可以了


你可能感兴趣的:(mysql/sql,server)