获取org.hibernate.util.jdbceptionReporter

获取org.hibernate.util.jdbceptionReporter,hibernate,openjpa,c3p0,Hibernate,Openjpa,C3p0,我有一个web应用程序,它使用hibernate和OpenJPA进行数据库连接。但是当应用程序空闲超过8小时时,我在日志文件中发现以下错误 2012年11月24日05:54:28 1206290820[http-8080-20]错误org.hibernate.util.jdbcece ptionReporter-从服务器成功接收的最后一个数据包是118,4 45988毫秒前。成功发送到服务器的最后一个数据包是11 8445989毫秒前。长于服务器配置的“等待”值_ 超时'。您应该考虑终止和/或测

我有一个web应用程序,它使用hibernate和OpenJPA进行数据库连接。但是当应用程序空闲超过8小时时,我在日志文件中发现以下错误

2012年11月24日05:54:28 1206290820[http-8080-20]错误org.hibernate.util.jdbcece
ptionReporter-从服务器成功接收的最后一个数据包是118,4
45988毫秒前。成功发送到服务器的最后一个数据包是11
8445989毫秒前。长于服务器配置的“等待”值_
超时'。您应该考虑终止和/或测试连接有效性。
在应用程序中使用之前,请增加cli的服务器配置值
ent超时,或使用连接器/J连接属性“autoReconnect=true”
为了避免这个问题。
2012年11月24日05:54:28 1206290820[http-8080-20]调试org.hibernate.ejb.AbstractE
ntityManagerImpl-标记回滚事务
2012年11月24日05:54:28 1206290820[http-8080-20]错误根-org.hibernate.excep
tion.jdbconnectionException:无法执行查询

我有以下persistence.xml条目


org.hibernate.connection.C3P0ConnectionProvider

在另一个里面!在Stackoverflow论坛上,他们说我们每次都应该关闭EntityManager对象

在我的应用程序中,我为EntityManager做了以下事情

我将EntityManager创建为一个单例类,并在整个应用程序中使用它

我错过什么了吗

更新

c3p0初始化的日志条目为:

INFO org.hibernate.connection.ConnectionProviderFactory-初始化连接提供程序:org.hibernate.connection.C3P0ConnectionProvider

INFO org.hibernate.connection.C3P0ConnectionProvider-C3P0使用驱动程序:com.mysql.jdbc.driver,URL:jdbc:mysql://xxx.xxx.xxx.xxx:3306/lbs?autoReconnect=true

INFO org.hibernate.connection.C3P0ConnectionProvider-连接属性:{user=**,password=**,autocommit=true,release\u mode=auto}

INFO org.hibernate.connection.C3P0ConnectionProvider-自动提交模式:true

WARN org.hibernate.connection.C3P0ConnectionProvider-已在hibernate.properties中设置了hibernate样式属性'hibernate.c3p0.idle\u test\u period'和c3p0样式属性'c3p0.idleConnectionTestPeriod'。将使用Hibernate样式属性“Hibernate.c3p0.idle\u test\u period”,并忽略c3p0样式属性“c3p0.idleConnectionTestPeriod”

INFO com.mchange.v2.log.MLog-使用log4j日志记录的MLog客户端。

INFO com.mchange.v2.c3p0.c3p0注册表-初始化c3p0-0.9.1[构建于2007年1月16日14:46:42;调试?真;跟踪:10]

DEBUG com.mchange.v2.c3p0.management.dynamicPooledDatasourceManagerBean-MBean:com.mchange.v2.c3p0:type=PooledDataSource[2RRRHZ8RC8XLPN1L7VN76 | 1b15828]已注册。

DEBUG com.mchange.v2.c3p0.management.dynamicPooledDataSourceManagerBean-MBean:com.mchange.v2.c3p0:type=PooledDataSource[2RRRHZ8RC8XLPN1L7VN76 | 1b15828]未注册,以便在更新后重新注册。

DEBUG com.mchange.v2.c3p0.management.dynamicPooledDatasourceManagerBean-MBean:com.mchange.v2.c3p0:type=PooledDataSource[2RRRHZ8RC8XLPN1L7VN76 | 1b15828]已注册。

INFO com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource-正在初始化c3p0池。。。com.mchange.v2.c3p0。PoolBackedDataSource@a340a84b[connectionPoolDataSource->com.mchange.v2.c3p0。WrapperConnectionPoolDataSource@454eed4 [acquireIncrement->3,AcquireEntryAttributes->30,AcquireEntryDisplay->1000,自动提交关闭->假,自动测试表->空,在AcquireFailure->假,签出超时->0,connectionCustomizerClassName->空,ConnectionTestClassName->com.mchange.v2.c3p0.impl.DefaultConnectionTester,DebuggeUnreturnedConnectionsTackTraces->false,factoryClassLocation->null,ForceIgnoreUnsolvedTransactions->false,identityToken->2RRRHZ8RC8XLPN1L7VN76 | 8010fe,idleConnectionTestPeriod->1800,initialPoolSize->5,maxAdministrativeTaskTime->0,maxConnectionAge->0,maxIdleTime->1800,maxIdleTimeExcessConnections->->0,maxPoolSize->20,Statement->50,maxStatementsPerConnection->0,minPoolSize->5,nestedDataSource->com.mchange.v2.c3p0。DriverManagerDataSource@f50d6507[description->null,driverClass->null,factoryClassLocation->null,identityToken->2RRRHZ8RC8XLPN1L7VN76 | 1233a8e,jdbcUrl->jdbc:mysql://xxx.xxx.xxx.xxx:3306/lbs?autoReconnect=true,物业->{user=*******,password=****,autocommit=true,release_mode=auto}],preferredTestQuery->null,propertyCycle->0,testConnectionOnCheckin->false,testConnectionOnCheckout->false,unreturnedConnectionTimeout->0,UseStraditionalReflectionProxies->false;userOverrides:{}],dataSourceName->null,factoryClassLocation->null,identityToken->2RRRHZ8RC8XLPN1L7VN76 | 1b15828,numHelperThreads->3]

DEBUG com.mchange.v2.resourcepool.BasicResourcePool-递增的挂起\u获取:1
DEBUG com.mchange.v2.resourcepool.BasicResourcePool-递增的挂起获取:2
DEBUG com.mchange.v2.resourcepool.BasicResourcePool-递增的挂起获取:3
DEBUG com.mchange.v2.resourcepool.BasicResourcePool-递增的挂起获取:4
DEBUG com.mchange.v2.resourcepool.BasicResourcePool-递增的挂起获取:5

DEBUG com.mchange.v2.resourcepool.BasicResourcePool-com.mchange.v2.resourcepool。BasicResourcePool@1148d7f配置:[开始->5;最小->5;最大->20;inc->3;尝试次数->30;尝试次数->延迟->1000;检查空闲资源\u延迟->1800000;最大可用资源\u ag