この問題についてインターネットで非常に多くの記事を読みましたが、明確な解決策があるようには見えません。データベースのタイムアウトが発生する理由について、誰かが明確な答えを教えてください。このアプリは、Tomcat 5.5 サーバーでホストされている GWT アプリです。私は春を使用し、セッション ファクトリは次のように applicationContext.xml に作成されます。
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${connection.dialect}</prop>
<prop key="hibernate.connection.username">${connection.username}</prop>
<prop key="hibernate.connection.password">${connection.password}</prop>
<prop key="hibernate.connection.url">${connection.url}</prop>
<prop key="hibernate.connection.driver_class">${connection.driver.class}</prop>
<prop key="hibernate.show_sql">${show.sql}</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.c3p0.min_size">5</prop>
<prop key="hibernate.c3p0.max_size">20</prop>
<prop key="hibernate.c3p0.timeout">1800</prop>
<prop key="hibernate.c3p0.max_statements">50</prop>
<prop key="hibernate.c3p0.idle_test_period">300</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>za.co.xxxx.traintrack.server.model.Answer</value>
<value>za.co.xxxx.traintrack.server.model.Company</value>
<value>za.co.xxxx.traintrack.server.model.CompanyRegion</value>
<value>za.co.xxxx.traintrack.server.model.Merchant</value>
<value>za.co.xxxx.traintrack.server.model.Module</value>
<value>za.co.xxxx.traintrack.server.model.Question</value>
<value>za.co.xxxx.traintrack.server.model.User</value>
<value>za.co.xxxx.traintrack.server.model.CompletedModule</value>
</list>
</property>
</bean>
<bean id="dao" class="za.co.xxxx.traintrack.server.DAO">
<property name="sessionFactory" ref="sessionFactory"/>
<property name="adminUsername" value="${admin.user.name}"/>
<property name="adminPassword" value="${admin.user.password}"/>
<property name="godUsername" value="${god.user.name}"/>
<property name="godPassword" value="${god.user.password}"/>
</bean>
翌日まですべて正常に動作します。
INFO | jvm 1 | 2010/06/15 14:42:27 | 2010-06-15 18:42:27,804 WARN
[JDBCExceptionReporter] : SQL Error: 0, SQLState: 08S01
INFO | jvm 1 | 2010/06/15 14:42:27 | 2010-06-15 18:42:27,821 ERROR
[JDBCExceptionReporter] : The last packet successfully received from the server
was 38729 seconds ago.The last packet sent successfully to the server was 38729
seconds ago, which 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.
INFO | jvm 1 | 2010/06/15 14:42:27 | Jun 15, 2010 6:42:27 PM
org.apache.catalina.core.ApplicationContext log
INFO | jvm 1 | 2010/06/15 14:42:27 | SEVERE: Exception while dispatching
incoming RPC call
私は非常に多くの異なるものを読みました(どれもうまくいきませんでした)、助けてください