zoukankan      html  css  js  c++  java
  • The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server

    © 版权声明:本文为博主原创文章,转载请注明出处

    1.问题描述

      搭建SSH框架,启动时报错如下:

    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.GeneratedConstructorAccessor17.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:425)
    	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:989)
    	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)
    	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2192)
    	at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2225)
    	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2024)
    	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:779)
    	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
    	at sun.reflect.GeneratedConstructorAccessor18.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:425)
    	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:389)
    	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
    	at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:175)
    	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:220)
    	at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:206)
    	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:203)
    	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1138)
    	at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1125)
    	at com.mchange.v2.resourcepool.BasicResourcePool.access$700(BasicResourcePool.java:44)
    	at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1870)
    	at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:696)
    Caused by: java.net.ConnectException: Connection refused: 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 com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
    	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)
    	... 20 more
    

    2.解决方案:

      可能一:未打开数据库服务

      可能二:没有创建相应的数据库

  • 相关阅读:
    DOM
    笔试题
    小案例
    前端基础面试题
    2048小游戏
    JS原型与构造函数
    String字符串和正则表达式
    数组
    MySQL_PHP学习笔记_2015_0906_使用PHP模板
    MySQL_PHP学习笔记_2015_0614_PHP传参总结_URL传参_表单传参
  • 原文地址:https://www.cnblogs.com/jinjiyese153/p/6957583.html
Copyright © 2011-2022 走看看