异常详细: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>
相关推荐
使用mysql+cp30连接池时,报错No operations allowed after connection closed。从报错信息来看,是connection断开导致的错误。在网上搜索后发现,较新版本的mysql配置了connection的默认时间,默认时间一般为8个...
- Video playback, Hard disk and CD/DVD test 'no operations' error reporting changed. - When BurnInTest crashes, it will not generate a "minidump" file. Minidumps will need to be sent to Microsoft ...
If no rows satisfy the WHERE condition the first time the range is scanned, no rows should be returned on any subsequent scans. Key range locks are similar to row locks on index keys (whether ...
After providing definitions of terms used, this document will outline the organisational structure (including role descriptions and communication lines), discuss the methodology model and after ...
To reserve or commit memory and unintentionally not release it when it is no longer being used. A process can leak resources such as process memory, pool memory, user and GDI objects, handles, threads...
- FIX: After deleting the selected points in the TFlexPanel.DeleteSelectedPoints the all figures with one point also deleted. - FIX: When the curve contain more then one figure and they were all ...