Software caused connection abort: socket write error
Posted on 2009-10-09 19:39 刘政道 阅读(2911) 评论(0) 编辑 收藏 举报
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