解决java.net.SocketException: Broken pipe异常

出现如下异常
解决的方式:参考hibernate配置文件:
Java代码 复制代码 收藏代码
  1. "dialect">org.hibernate.dialect.MySQLDialect
  2. "connection.driver_class">com.mysql.jdbc.Driver
  3. "connection.url">
  4. jdbc:mysql://localhost/tonyshao?characterEncoding=gb2312&zeroDateTimeBehavior=convertToNull
  5. "connection.username">user
  6. "connection.password">passport
  7. "hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider
  8. "hibernate.cache.use_query_cache">true
  9. "hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider
  10. "hibernate.connection.pool_size">2
  11. "hibernate.connection.autocommit">false
  12. "c3p0.timeout">30000
  13. "c3p0.max_statements">50
  14. "c3p0.idle_test_period">28000
  15. "c3p0.acquire_increment">1
	
	org.hibernate.dialect.MySQLDialect
	com.mysql.jdbc.Driver

	
	
		jdbc:mysql://localhost/tonyshao?characterEncoding=gb2312&zeroDateTimeBehavior=convertToNull
	

	user
	passport

	org.hibernate.cache.EhCacheProvider
	true
	
	org.hibernate.connection.C3P0ConnectionProvider 
	2
	
	false
	
	
    
    30000
    
    50
    
    28000
    1

Java代码 复制代码 收藏代码
  1. Lastpacketsenttotheserverwas1msago.
  2. STACKTRACE:
  3. com.mysql.jdbc.CommunicationsException:Communicationslinkfailureduetounderlyingexception:
  4. **BEGINNESTEDEXCEPTION**
  5. java.net.SocketException
  6. MESSAGE:Brokenpipe
  7. STACKTRACE:
  8. java.net.SocketException:Brokenpipe
  9. atjava.net.SocketOutputStream.socketWrite0(NativeMethod)
  10. atjava.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
  11. atjava.net.SocketOutputStream.write(SocketOutputStream.java:136)
  12. atjava.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
  13. atjava.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
  14. atcom.mysql.jdbc.MysqlIO.send(MysqlIO.java:2692)
  15. atcom.mysql.jdbc.MysqlIO.send(MysqlIO.java:2621)
  16. atcom.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1552)
  17. atcom.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
  18. atcom.mysql.jdbc.Connection.execSQL(Connection.java:2994)
  19. atcom.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
  20. atcom.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1030)
  21. atorg.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:139)
  22. atorg.hibernate.loader.Loader.getResultSet(Loader.java:1669)
  23. atorg.hibernate.loader.Loader.doQuery(Loader.java:662)
  24. atorg.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
  25. atorg.hibernate.loader.Loader.loadEntity(Loader.java:1785)

你可能感兴趣的:(解决java.net.SocketException: Broken pipe异常)