java - com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure? -



java - com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure? -

i running spring mvc application hibernate.cfg below:

<property name="hibernate.transaction.factory_class">org.hibernate.transaction.jdbctransactionfactory</property> <property name="dialect">org.hibernate.dialect.mysqldialect</property> <property name="hibernate.connection.useunicode">true</property> <property name="hibernate.connection.characterencoding">utf-8</property> <property name="hibernate.connection.charset">utf-8</property> <property name="connection.url">jdbc:mysql://10.2.10.123:3306/xxx</property> <property name="connection.driver_class">com.mysql.jdbc.driver</property> <property name="connection.username">xxx</property> <property name="generate_statistics">false</property> <property name="connection.password">xxx</property> <property name="c3p0.testconnectiononcheckout">true</property> <property name="connection.provider_class">org.hibernate.connection.c3p0connectionprovider</property> <property name="c3p0.acquire_increment">1</property> <property name="c3p0.idle_test_period">100</property> <!-- seconds --> <property name="c3p0.max_size">50</property> <property name="c3p0.max_statements">0</property> <property name="c3p0.min_size">10</property> <property name="c3p0.timeout">7200</property> <property name="current_session_context_class">thread</property> <property name="c3p0.numhelperthreads">5</property> <property name="show_sql">false</property>

when run application in local environment, runs without problem. on server gives exception as:

com.mysql.jdbc.exceptions.jdbc4.communicationsexception: communications link failure

the lastly packet received server 206,756 milliseconds ago. lastly packet sent server 3 milliseconds ago.

further next log:

caused by: java.io.eofexception: can not read response server. expected read 4 bytes, read 0 bytes before connection unexpectedly lost. @ com.mysql.jdbc.mysqlio.readfully(mysqlio.java:3119) @ com.mysql.jdbc.mysqlio.reuseandreadpacket(mysqlio.java:3573) ... 90 more debug: 11:42:41.858 com.mchange.v2.resourcepool.basicresourcepool.trace(basicresourcepool.java:1644) - trace com.mchange.v2.resourcepool.basicresourcepool@2b5cccf1 [managed: 7, unused: 6, excluded: 0] (e.g. com.mchange.v2.c3p0.impl.newpooledconnection@5700187d) debug: 11:42:41.861 com.mchange.v2.resourcepool.basicresourcepool.decrementpendingacquires(basicresourcepool.java:422) - decremented pending_acquires: 0 debug: 11:42:41.858 com.mchange.v2.resourcepool.basicresourcepool$1destroyresourcetask.run(basicresourcepool.java:967) - destroyed resource: com.mchange.v2.c3p0.impl.newpooledconnection@61b03322 debug: 11:42:41.861 com.mchange.v2.c3p0.impl.c3p0pooledconnectionpool$1pooledconnectionresourcepoolmanager.finerloggingtestpooledconnection(c3p0pooledconnectionpool.java:323) - test of pooledconnection [com.mchange.v2.c3p0.impl.newpooledconnection@c2beb14] on checkout has failed. java.sql.sqlexception: connection invalid

can help?

i solved increasing value of wait_timeout , interactive_timeout on mysql server 3600 seconds(1 hour), before set 60 seconds both.

java mysql hibernate spring-mvc c3p0

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -