同じインスタンス上で実行されているmysqlインスタンスと通信するJavaアプリケーションを実行しているマシンがあります。アプリ は、mysqlのjdbc4ドライバを使用します。私はcom.mysql.jdbc.exceptions.jdbc4.CommunicationsExceptionをランダムに取得しています。 jdbc4 CommunicationsException
ここにメッセージ全体があります。
トランザクションのJDBC接続をオープンできませんでした。ネストされた例外は、MySQLの
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was25899 milliseconds ago.The last packet sent successfully to the server was 25899 milliseconds 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.
で、グローバルな「WAIT_TIMEOUT」と「は、interactive_timeout」の値は3600秒に設定されていると「CONNECT_TIMEOUTは、」60秒に設定されています。待機タイムアウト値は26秒(25899ミリ秒)よりもはるかに高い値です。例外トレースに記載されています。
私は接続プーリングにdbcpを使用していますが、ここではデータソース用のSpring Beanの設定です。
<bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource" >
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/db"/>
<property name="username" value="xxx"/>
<property name="password" value="xxx" />
<property name="poolPreparedStatements" value="false" />
<property name="maxActive" value="3" />
<property name="maxIdle" value="3" />
</bean>
なぜこれが起こっているのでしょうか? c3p0を使用して問題を解決できますか?
Thnx、これは現時点で動作しているようです。 – letronje