0

私の製品サーバーでは例外を下回っていますが、数時間後に自動的に解決されます。この問題の原因は何ですか

Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was234747 milliseconds ago.The last packet sent successfully to the server was 234747 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.

すでに autoReconnect=true を設定しています。フォーラムから、アイドル接続テストを有効にする必要があることがわかりました。お知らせ下さい

アプリケーションで閉じられていない接続があると、この例外が発生しますか?

私たちは Ibatis を使用しており、以下は Ibatisconfig ファイルです。

<transactionManager type="JDBC" commitRequired="true">
    <dataSource type="SIMPLE">
        <property name="JDBC.Driver" value="com.mysql.jdbc.Driver" />
        <property name="JDBC.ConnectionURL"
            value="<URL>?autoReconnect=true" />
        <property name="JDBC.Username" value="<username>" />
        <property name="JDBC.Password" value="<password>" />
        <property name="JDBC.DefaultAutoCommit" value="false" />
        <property name="Pool.TimeToWait" value="100" />
        <property name="Pool.PingQuery" value="select 1" />
        <property name="Pool.PingEnabled" value="true" />
        <property name="Pool.PingConnectionsOlderThan" value="300000" />
        <property name="Pool.PingConnectionsNotUsedFor" value="300000" />
    </dataSource>
</transactionManager>
4

1 に答える 1

1

さて、私のプロジェクトでは、同じ問題に直面しました。mysql を使用しており、接続が 8 時間アイドル状態になると、db が使用できなくなります。私たちが使用したソリューションは、C3P0 接続プールを使用することでした。これについてはこちらで確認してください。 http://www.mchange.com/projects/c3p0/

于 2013-08-02T07:39:36.717 に答える