Communication error error in mysql in Heroku project

I am working on a hibernate Spring project which is on Heroku and uses ClearDB. When my page has been idle for some time (hardly a minute), and then I send a request to the server, I get an error as follows:

HTTP ERROR 500

Problem accessing /authenticate.action. Reason:

Communications link failure

Last packet sent to the server was 16 ms ago.; nested exception is    org.hibernate.exception.JDBCConnectionException: Communications link failure

Last packet sent to the server was 16 ms ago.
Caused by:

org.springframework.dao.DataAccessResourceFailureException: Communications link failure

Last packet sent to the server was 16 ms ago.; nested exception is org.hibernate.exception.JDBCConnectionException: Communications link failure

Last packet sent to the server was 16 ms ago.
at     org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:631)
at     org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:104)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:403)
at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:58)
at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:213)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:163)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at sun.proxy.$Proxy33.authenticate(Unknown Source)
Caused by: org.hibernate.exception.JDBCConnectionException: Communications link failure

Last packet sent to the server was 16 ms ago.
at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:131)
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125)
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110)
at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:129)
at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
at sun.proxy.$Proxy75.executeQuery(Unknown Source)

I tried to find answers on the network, and I made some configuration settings as follows:

Here is my data source configuration:

<beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<beans:property name="url" value="#{ 'jdbc:mysql://' + @dbUrl.getHost() +  @dbUrl.getPath()  + '?reconnect=true'}"/>
<beans:property name="username" value="#{ @dbUrl.getUserInfo().split(':')[0] }"/>
<beans:property name="password" value="#{ @dbUrl.getUserInfo().split(':')[1] }"/>
<beans:property name="minEvictableIdleTimeMillis" value="1800000"/>

I still get an error every time I leave the page in standby mode for a minute or so. I do not get this error if my server requests do not stop.

, . , , . Heroku, . - ?

,

+3

All Articles