您的位置:首页 > 数据库 > SQL

MySQL - No operations allowed after connection closed.;

2017-01-10 00:00 609 查看
摘要: No operations allowed after connection closed.; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

昨天晚上项目放到阿里云的ubt14.04系统中。tomcat8.5.8/jdk1.8/mysql5.7;今天早上打开阿里云服务器上的页面,登录报错:

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataAccessResourceFailureException:
### Error querying database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.
### The error may exist in file [/usr/local/apache-tomcat-8.5.8/webapps/weiwei_01/WEB-INF/classes/com/shark/mapper/auth/AuthUser.mapper.xml]
### The error may involve com.shark.dao.auth.AuthUserDAO.findAuthUserByMobileAndPwd
### The error occurred while executing a query
### SQL: select * from wei_auth_user where mobile = ? and login_pwd = ?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.
; SQL []; No operations allowed after connection closed.; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after connection closed.

在网上找到博客:

《No operations allowed after connection closed.Connection was implicitly closed 》
http://www.myexception.cn/operating-system/1311178.html
查看自己使用的dataSource为:org.apache.commons.dbcp.BasicDataSource
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="validationQuery" value="select 1" />
<property name="testWhileIdle" value="true" />
<!-- some positive integer -->
<property name="timeBetweenEvictionRunsMillis" value="3600000" />
<!-- set to something smaller than 'wait_timeout' -->
<property name="minEvictableIdleTimeMillis" value="18000000" />
<!-- if you don't mind a hit for every getConnection(), set to "true" -->
<property name="testOnBorrow" value="true" />

<property name="url" value="jdbc:mysql://localhost/[DBname]?serverTimezone=UTC&useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true"></property>
<property name="username" value="root"/>
<property name="password" value="***"/>
</bean>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  MySQL
相关文章推荐