1,环境:mysql+tomcat+linux
2,发现问题:连接池断开连接
No operations allowed after connection closed
连接池断开了,再进行连接就报错了
添加:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="${c3p0.driverClass}" /> <property name="jdbcUrl" value="${c3p0.url}" /> <property name="user" value="${c3p0.user}" /> <property name="password" value="${c3p0.password}" /> <property name="minPoolSize" value="5"/> <property name="maxPoolSize" value="30"/> <property name="initialPoolSize" value="15"/> <property name="maxStatements" value="0"/> <property name="maxIdleTime" value="60"/> <property name="acquireIncrement" value="5"/> <property name="idleConnectionTestPeriod" value="59"/> <property name="acquireRetryAttempts" value="30"/> <property name="automaticTestTable" value="c3p0"/> <property name="numHelperThreads" value="5"/> </bean>
然而解决了这个问题,tomcat依旧会断开。
3,添加jvm参数。
找到了tomcat目录下的bin文件下的catalina.sh
cygwin=false //在这行下面添加JAVA_OPTS="-server -Xms128m -Xmx512m -XX:PermSize=128M -XX:MaxPermSize=512m"
时间: 2024-10-11 17:27:37