我開發了一個Web應用程序,在這個JSF中是前端,mysql是後端。我正在使用Hibernate ORM框架來連接數據庫。我在tomcat中託管我的應用程序,它在一段時間內工作正常。經過一段時間我得到了一些例外,如一段時間後數據庫連接丟失
Dec 25, 2014 9:50:50 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
ERROR: No operations allowed after connection closed.
Dec 25, 2014 9:50:50 AM org.hibernate.engine.jdbc.spi.SqlExceptionHelper logExceptions
WARN: SQL Error: 0, SQLState: 08003
之後,我無法從數據庫中檢索值。如果我重新啓動我的tomcat意味着它可以在幾個小時的時間內正常工作。
<property name="hibernate.bytecode.use_reflection_optimizer">false</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">*****</property>
<property name="hibernate.connection.url">jdbc:mysql://192.168.1.253:3306/Test</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.jdbc.batch_size">30</property>
<property name="hibernate.search.autoregister_listeners">false</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.c3p0.max_size">100</property>
<property name="hibernate.c3p0.min_size">3</property>
<property name="hibernate.c3p0.timeout">900</property>
<property name="hibernate.c3p0.max_statements">100</property>
任何一個建議我解決我的錯誤的正確方法。