MySQL Hibernate-Verbindungsproblem bei Verwendung von c3p0
Ich habe eine Webanwendung mit Struts 1.3, Hibernate3 und Spring Security entwickelt. Die Anwendung war zuvor nach 8 Stunden tot, da MySQL die Verbindung nach Ablauf der Zeit geschlossen hatte. Dann sammle ich die Informationen aus mehreren Posts, um sie noch lange am Leben zu erhalten, jetzt sind es fast 20 - 24 Stunden. Kann mir irgendein Körper helfen, das Ding zum Laufen zu bringen?
Zusammenfassun
Ich kann mich nach 20 Stunden Inaktivität nicht anmelden. Die Verbindung wird von MySQL geschlossen.
Vielen Dank
Bitte finden Sie die folgenden Snippets für die Konfiguration von Hibernate und C3P0.
Hibernate cfg file snippet
<property name="hibernate.dialect">se.etm.ewo.hibernate.CustomDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">MY_JDBC_URL?autoReconnect=true</property>
<property name="hibernate.connection.username">username</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.connection.autoReconnect">true</property>
<property name="hibernate.connection.autoReconnectForPools">true</property>
<property name="hibernate.c3p0.idle_test_period">100</property>
<property name="hibernate.c3p0.preferredTestQuery">select 1</property>
<property name="hibernate.c3p0.testWhileIdle">true</property>
<property name="hibernate.c3p0.testConnectionOnCheckout">true</property>
<property name="hibernate.c3p0.min_size">10</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<property name="hbm2ddl.auto">update</property>
<property name="hibernate.current_session_context_class">thread</property>
Konfigurationsstück ab Frühling
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
<property name="hibernateProperties">
<ref bean="hibernateProperties" />
</property>
</bean>
<bean id="hibernateProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="ignoreResourceNotFound" value="true" />
<property name="location">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean>
<!-- Data source -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="jdbcUrl">
<value>MY_JDBC_URL?autoReconnect=true</value>
</property>
<property name="user">
<value>username</value>
</property>
<property name="password">
<value>password</value>
</property>
<property name="initialPoolSize">
<value>10</value>
</property>
<property name="maxPoolSize">
<value>30</value>
</property>
<property name="minPoolSize">
<value>10</value>
</property>
<property name="maxConnectionAge">
<value>3600</value>
</property>
<property name="maxIdleTime">
<value>3600</value>
</property>
<property name="maxIdleTimeExcessConnections">
<value>1800</value>
</property>
<property name="acquireRetryAttempts">
<value>3</value>
</property>
<property name="acquireRetryDelay">
<value>3000</value>
</property>
<property name="breakAfterAcquireFailure">
<value>false</value>
</property>
<property name="preferredTestQuery">
<value>SELECT 1</value>
</property>
<property name="testConnectionOnCheckout">
<value>true</value>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
C3p0 log
INFO AbstractPoolBackedDataSource: 462 - c3p0-Pool wird initialisiert ... com.mchange.v2.c3p0.ComboPooledDataSource [acquisIncrement -> 3, acquisRetryAttempts -> 3, acquisRetryDelay -> 3000, autoCommitOnClose -> false, automaticTestAfailFailFable false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1br9tik951ql1qj1z141xq | 2a868f36, debugUnretacked .jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1br9tik951qql1qj1z141xq | 2a868f36, idleConnectionTestPeriod -> 0, initialPoolSize -> 10, jdbcfccfcfcfdrrrrrrl null, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 3600, maxIdleTime -> 3600, maxIdleTimeExcessConnections -> 1800, maxPoolSize -> 30, maxStatements -> 0 , maxStatementsPerConnection -> 0, minPoolSize -> 10, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> SELECT 1, Eigenschaften -> {user = ******, password = ******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> true, nicht zurückgegebenConnectionTimeout -> 300, usesTraditionalReflectiveProxies -> false]
Das c3p0-Protokoll sieht genau nach diesen Zeilen aus. Können Sie etwas finden.