标签:
Could not roll back Hibernate transaction; nested exception is org.hibernate.TransactionException: JDBC rollback failed
Caused by: java.sql.SQLException: Couldn‘t perform the operation rollback: You can‘t perform any operations on this connection. It has been automatically closed by Proxool for some reason (see logs).
前几天打在服务器上的WEB项目第二天当我打开的时候就会报错,
显示如图所示:
这里的找到的原因是线程池的问题,意思就是每天的一个时刻,就会有一种代理把你的数据库给关闭掉。
那么这里我处理的方法是配置文件:
找到:hibernate.cfg.xml这个文件然后修改器配置。我修改的是这里:<property name="hibernate.connection.provider_class"> org.hibernate.connection.ProxoolConnectionProvider </property> <property name="hibernate.proxool.pool_alias">DBPool</property> <property name="hibernate.proxool.xml">proxool.xml</property> <property name="connection.autoReconnect">true</property> <property name="connection.autoReconnectForPools">true</property> <property name="connection.is-connection-validation-required"> true </property>这样就可以了。我在网上还看到了另一种方就是:<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property> <property name="c3p0.acquire_increment">1</property> <property name="c3p0.idle_test_period">100</property> <property name="c3p0.max_size">5</property> <property name="c3p0.max_statements">0</property> <property name="c3p0.min_size">2</property> <property name="c3p0.timeout">90</property> <property name="c3p0.idleConnectionTestPeriod ">18000</property> <property name="c3p0.maxIdleTime">25000</property> <property name="c3p0.testConnectionOnCheckout">true</property>也可以运行
500 - org.hibernate.TransactionException: JDBC rollback failed
标签:
原文地址:http://blog.csdn.net/u012965373/article/details/44454815