异常详细:ERROR: No operations allowed after connection closed.
异常原因:Caused by: org.hibernate.TransactionException: unable to rollback against JDBC connection
.................
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 53,775,153 milliseconds ago. The last packet sent successfully to the server was 53,775,153 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.
Mysql服务器默认的“wait_timeout”是8小时,也就是说一个connection空闲超过8个小时,Mysql将自动断开该connection。当connection设置为static类型时候,connection pools中的connections如果空闲超过8小时,mysql将其断开,connection提交或者撤销事务时,就会出现上面的异常。
解决方案:其实上面的异常原因有提示具体的解决方案。
<property name="connection.provider_class">org.hibernate.c3p0.internal.C3P0ConnectionProvider</property> <!-- 最小连接数 --> <property name="hibernate.c3p0.min_size">5</property> <!-- 最大连接数 --> <property name="hibernate.c3p0.max_size">20</property> <!-- 获得连接的超时时间,如果超过这个时间,会抛出异常,单位毫秒 --> <property name="hibernate.c3p0.timeout">300</property> <!-- 每隔3000秒检查连接池里的空闲连接 ,单位是秒--> <property name="hibernate.c3p0.idle_test_period">3000</property> <!--查询的最大结果集 --> <property name="hibernate.c3p0.max_statements">50</property> <!-- 每次都验证连接是否可用 --> <property name="hibernate.c3p0.validate">true</property> <!-- 当连接池里面的连接用完的时候,C3P0一下获取的新的连接数 --> <property name="hibernate.c3p0.acquire_increment">2</property>
相关推荐
解决:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after statement closed.
使用mysql+cp30连接池时,报错No operations allowed after connection closed。从报错信息来看,是connection断开导致的错误。在网上搜索后发现,较新版本的mysql配置了connection的默认时间,默认时间一般为8个...
java.sql.SQLException: Operation not allowed after ResultSet closed java.sql.SQLException: QueryRunner requires a DataSource to be invoked in this way, or a Connection should be passed in
主要介绍了php采用curl访问域名返回405 method not allowed提示的解决方法,需要的朋友可以参考下
php解决Allowed memory size of bytes exhausted
Android WebView 报 Not allowed to load local resource错误的解决办法 博客地址:http://blog.csdn.net/yuzhiqiang_1993/article/details/76228541
php Allowed memory size of 134217728 bytes exhausted
NULL 博文链接:https://yizhilong28.iteye.com/blog/1137285
mysql5.7 修改max_allowed_packet方法
一、什么是跨域问题 在一个服务器A里放置了json文件,另一个服务器B想向A发送ajax请求,...解决方案有不少,比较好的是服务器端配置CORS,但要求服务器端做更改。如果在不需要更改服务器端的情况下解决呢?尤其是需要在
使用Spring提供的Open Session In View而引起Write operations are not allowed in read-only mode (FlushMode.NEVER) 错误解决
设置隐试打开PPT报错 Hiding the application window is not allowed
本文实例讲述了ThinkPHP提示错误Fatal error: Allowed memory size的解决方法。分享给大家供大家参考。具体分析如下: 如果你的ThinkPHP提示你:致命错误(Fatal error: Allowed memory size),根据网上说的提高...
mysql设置max_allowed_packet_解决_MySQL_Error_2006
"Host 'localhost' is not allowed to connect to this MySQL server" 的原因及解决办法
现象: … java: 1801: method does not override a method from its superclass @Override… 原因: Eclipse is defaulting to Java 1.5 and you have classes implementing interface methods (which in Java 1.6 ...
es6转es5时报Use `--Error: Plugin/Preset files are not allowed to export objects, only functions最粗暴解决方案的四个文件
However, no change of operating state or stored data is allowed to persist after the test. After the test, the EUT shall continue to operate as intended without operator intervention. No degradation ...
NR5G网络拒绝码-5gmm_cause = 7 (0x7) (5GS Service not allowed)