Software caused connection abort: socket write error


57151609 [http-80-21] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 08S01

57151609 [http-80-21] ERROR org.hibernate.util.JDBCExceptionReporter - Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException

MESSAGE: Software caused connection abort: socket write error

STACKTRACE:

java.net.SocketException: Software caused connection abort: socket write error


Mysql connection timeout is 8 hours,or connection will close.


We can use c3p0 to resolve this error.


Modify the hibernate.cfg.xml like this:


<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>& amp;amp; lt;br /> <property name="hibernate.c3p0.min_size">8</property>
<property name="hibernate.c3p0.max_size">200</property>
<property name="hibernate.c3p0.timeout">600</property>
<property name="hibernate.c3p0.max_statements">0</property>
<property name="hibernate.c3p0.idle_test_period">60</property>
<property name="hibernate.c3p0.acquire_increment">2</property>
<property name="hibernate.c3p0.validate">true</property>


You should also add

hibernate3.jar

c3p0-0.9.1.jar





原文地址:https://www.cnblogs.com/liuzhengdao/p/1579852.html