关键字:
SpringMVC spring dao 配置 阿里 druid 连接池 出现
Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server
2017-02-24 14:26:53 [ Druid-ConnectionPool-Create-675798468:1 ] - [ ERROR ] create connection error, url: jdbc:mysql://localhost:3306/fangdb?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true, errorCode 0, state 08S01 com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.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:425)at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:632)at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1016)at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253)at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284)at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)at com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:806)at com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:47)
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:425)
...
解决方案:
把jdk从1.7改成1.8
参考:
https://pagespeed.v2ex.com/t/254112