启动工程后,开始运行正常,但运行一段时间访问量稍微变大后控制台会报错:
1. org.hibernate.exception.JDBCConnectionException: could not execute query
2. at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
3. at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
4. .......
5. Caused by: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed due to underlying exception/error:
6.
7.
8. ** BEGIN NESTED EXCEPTION **
9.
10. com.mysql.jdbc.CommunicationsException
11. MESSAGE: Communications link failure due to underlying exception:
12.
13. ** BEGIN NESTED EXCEPTION **
14.
15. java.net.SocketException
16. MESSAGE: Broken pipe
17.
18. STACKTRACE:
19.
20. java.net.SocketException: Broken pipe
21. at java.net.SocketOutputStream.socketWrite0(Native Method)
22. ......
23. ** END NESTED EXCEPTION **
连接池的问题,网上对比 c3p0 表现最好,我们这里也不用dbcp了,改用c3p0,查阅c3p0的文档在官方网站上找不到,注意dbcp和c3p0的文档都是在它们的下载包里面,而不是在官方网站上。
将配置文件改成c3p0:
<bean id="mysqldb"
class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass"
value="com.mysql.jdbc.Driver">
</property>
<property name="jdbcUrl"
value="jdbc:mysql://192.168.1.44:3306/clothes?useUnicode=true&amp;characterEncoding=gbk&amp;characterSetResults=gbk">
</property>
<property name="user" value="yourname"></property>
<property name="password" value="yourpsd"></property>
<property name="testConnectionOnCheckin" value="true"></property>
<property name="automaticTestTable" value="testc3p0"></property>
<property name="idleConnectionTestPeriod" value="18000"></property>
<property name="maxIdleTime" value="25000"></property>
<property name="testConnectionOnCheckout" value="true"></property>
<property name="autoCommitOnClose" value="true"></property>
<property name="checkoutTimeout" value="30000"></property>
<property name="initialPoolSize" value="2"></property>
<property name="minPoolSize" value="2"></property>
<property name="maxPoolSize" value="5"></property>
<property name="acquireIncrement" value="1"></property>
<property name="maxIdleTimeExcessConnections" value="20000"></property>
</bean>
问题解决。
参考:
http://fishyych.iteye.com/blog/90793
http://azi.iteye.com/blog/182146
http://blog.csdn.net/voff12/archive/2007/06/03/1636344.aspx
http://blog.csdn.net/lip8654/archive/2008/02/26/2121387.aspx
分享到:
相关推荐
1、写在开头 标题之前我想说一下Linux的mysql真的实在是太坑了。太坑了。总是会出现这样那样的你想不到的问题。崩溃了。首先来罗列一下我遇到过的...Cause:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorExcepti
Cause com.mysql.jdbc.exceptions.jdbc4.CommunicationsException The last packet successfully received from the server was 47,795,922 milliseconds ago. The last packet sent successfully to the server was...
博文链接:https://zyx19920203.iteye.com/blog/2301226
c-jdbc数据库集群中间件详细配置方案(mysql),可以同步使用多个数据库数据交换。
解决:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after statement closed.
MyEclipse8.x 汉化 包括汉化语言包和汉化方法
com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error:GlobalConfigUtils setMetaData Fail !
• 并发事务,间隙锁可能互斥 (1)A删除不存在的记录,获取共享间隙锁; (2)B插入,必须获得排他间隙锁,故互斥; • 并发插入相同记录,可能死锁(某一个回滚) • 并发插入,可能出现间隙锁死锁(难排查) ...
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Access denied for user ''@'localhost' to database 'hibernate' at sun.reflect.NativeConstructorAccessorImpl.new
1、Caused by: com.MySQL.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 56,201,339 milliseconds ago. The last packet sent successfully to the...
可用包+源码;最新版nacos-server-1.2.0.tar.gz 支持mysql 8.0
可以通过异常:Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Acc
问题 Table ‘zup.Domain_System’ doesn’t exist ...### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'zup.Domain_System' doesn't exist ; bad SQL grammar []; nested
Mybatis报错: org.apache.ibatis.exceptions.PersistenceException解决办法 一、问题描述 写好配置文件用JUnit进行测试,一运行就报错: org.apache.ibatis.exceptions.PersistenceException: ### Error querying ...
jeecms2012sp1支持高版本mysql数据库补丁 ...com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown table 'table_names' in information_schema 使用方法:压缩包解压,将文件拷贝到对应的目录即可
Aspnet-aspnet.webapi.exceptions.mapper.zip,依赖注入APIException mapperaspnet.webapi.exceptions.mapper,asp.net是一个开源的web框架,用于使用.net构建现代web应用和服务。asp.net创建基于html5、css和...
自动化的异常,selenium.common.exceptions.StaleElementReferenceException
今天用execjs调用JS时,发现报错execjs._exceptions.ProgramError: ReferenceError: document is not defined 如图: 错误类型:文档对象未定义,解决方法,定义对象即可,习惯性定义变量嘛 var document ;? ...
mysql数据库版本从5.6.28升到8.0.11过程中部署项目时遇到的问题和解决方法,具体介绍如下所示: 首先这个项目用到了hibernate4.2.0,链接mysql...2.访问报错com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientCon