SSM框架Tomcat跑一段时间后抛异常 1C

用的是Spring + SpringMVC+ Mybatis
项目部署后跑一段时间后会跑异常 但是可以正常访问 下面是抛出的异常:
2017-08-10 03:20:46 [Prototyper] ERROR org.logicalcobwebs.proxool.lvseu - Prototype
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2270)
at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:723)
at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:46)
at sun.reflect.GeneratedConstructorAccessor57.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
at java.sql.DriverManager.getConnection(DriverManager.java:187)
at org.logicalcobwebs.proxool.DefaultConnectionBuilder.buildConnection(DefaultConnectionBuilder.java:39)
at org.logicalcobwebs.proxool.Prototyper.buildConnection(Prototyper.java:159)
at org.logicalcobwebs.proxool.Prototyper.sweep(Prototyper.java:102)
at org.logicalcobwebs.proxool.PrototyperThread.run(PrototyperThread.java:44)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Last packet sent to the server was 0 ms ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:335)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2194)
... 14 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:579)
at java.net.Socket.connect(Socket.java:528)
at java.net.Socket.(Socket.java:425)
at java.net.Socket.(Socket.java:241)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:253)
at com.mysql.jdbc.MysqlIO.(MysqlIO.java:284)
... 15 more

我的配置文件
proxool.prototypeCount=5

proxool.maximumActiveTime=300000
proxool.maximumConnectionLifetime=18000000
proxool.minimumConnectionCount=5
proxool.maximumConnectionCount=40
proxool.alias=lvseu
proxool.simultaneous-build-throttle=20
proxool.prototype-count=2
proxool.houseKeepingTestSql=select CURRENT_DATE
proxool.hourseKeepingSleepTime=30000




    <!-- 测试的SQL执行语句 -->
    <property name="houseKeepingTestSql" value="${proxool.houseKeepingTestSql}"/>

    <!-- 最少保持的空闲连接数 (默认2个) -->
    <property name="prototypeCount" value="${proxool.prototypeCount}" />

    <!-- 最大活动时间(超过此时间线程将被kill,默认为5分钟) -->
    <property name="maximumActiveTime" value="${proxool.maximumActiveTime}" />

    <!-- 最小连接数 (默认2个) -->
    <property name="minimumConnectionCount" value="${proxool.minimumConnectionCount}" />

    <!-- 最大连接数 (默认10个) -->
    <property name="maximumConnectionCount" value="${proxool.maximumConnectionCount}" />

    <!-- 连接最长时间(默认为4个小时) -->
    <property name="maximumConnectionLifetime" value="${proxool.maximumConnectionLifetime}" />  

    <!-- 数据库别名 -->
    <property name="alias" value="${proxool.alias}" />

    <!-- proxool自动侦察各个连接状态的时间间隔(毫秒),侦察到空闲的连接就马上回收,超时的销毁 默认30秒) -->
    <property name="houseKeepingSleepTime" value="${proxool.hourseKeepingSleepTime}" />  

求大神给看一下 自己找了很久 曾百度说是数据库8个小时断开连接 按这个结果也试了 还是报

4个回答

“my.ini”(mysql5 installation dir),增加一行:wait_timeout=1814400

参考:http://blog.csdn.net/zmzsoftware/article/details/6835604

你那个连接池链接的时候默认加密了吗

数据库远程的话可能也是网略不稳定的原因。如果是本地或局域网之内,应该就是mysql的配置问题。
很遗憾我并没有清晰的解决办法!!

jar包的问题 找到了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!