为了账号安全,请及时绑定邮箱和手机立即绑定

连接超时,我上网翻看了好多答案都不行 ,求大神指点,指点

连接超时,我上网翻看了好多答案都不行 ,求大神指点,指点

向日葵一族 2017-02-09 17:43:49
信息: Server startup in 974 mscom.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failureThe 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:39)    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)    at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)    at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:988)    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:341)    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2251)    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284)    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)    at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)    at java.sql.DriverManager.getConnection(DriverManager.java:582)    at java.sql.DriverManager.getConnection(DriverManager.java:185)    at test.DaoFactory.getConnection(DaoFactory.java:24)    at daoimpl.BookDaoImpl.queryAllbooks(BookDaoImpl.java:26)    at org.apache.jsp.index_jsp._jspService(index_jsp.java:92)    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1774)    at java.lang.Thread.run(Thread.java:619)Caused by: java.net.UnknownHostException: localhose    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)    at java.net.InetAddress$1.lookupAllHostAddr(InetAddress.java:849)    at java.net.InetAddress.getAddressFromNameService(InetAddress.java:1200)    at java.net.InetAddress.getAllByName0(InetAddress.java:1153)    at java.net.InetAddress.getAllByName(InetAddress.java:1083)    at java.net.InetAddress.getAllByName(InetAddress.java:1019)    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:188)    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:300)    ... 35 morejava.lang.NullPointerException    at daoimpl.BookDaoImpl.queryAllbooks(BookDaoImpl.java:27)    at org.apache.jsp.index_jsp._jspService(index_jsp.java:92)    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1774)    at java.lang.Thread.run(Thread.java:619)
查看完整描述

3 回答

已采纳
?
习惯受伤

TA贡献885条经验 获得超1144个赞

这个主要有:1,MySQL服务器是否启动,端口是否开放,用telnet测试一下。2,JAVA中MySQL的配置超时时间太短。3,驱动和MySQL是否一致。
查看完整回答
反对 回复 2017-02-09
  • 向日葵一族
    向日葵一族
    使用telnet测试mysql端口吗? 在在cmd输入ping 192.????? 啥呀
  • 3 回答
  • 0 关注
  • 1799 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信