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

帮忙看看报错?数据库连接不上报错?

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: 


** BEGIN NESTED EXCEPTION ** 


java.net.ConnectException

MESSAGE: Connection refused: connect


STACKTRACE:


java.net.ConnectException: Connection refused: connect

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)

at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

at java.net.Socket.connect(Socket.java:529)

at java.net.Socket.connect(Socket.java:478)

at java.net.Socket.<init>(Socket.java:375)

at java.net.Socket.<init>(Socket.java:218)

at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:173)

at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:267)

at com.mysql.jdbc.Connection.createNewIO(Connection.java:2739)

at com.mysql.jdbc.Connection.<init>(Connection.java:1553)

at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)

at java.sql.DriverManager.getConnection(DriverManager.java:582)

at java.sql.DriverManager.getConnection(DriverManager.java:185)

at util.DBHelper.getConnection(DBHelper.java:34)

at dao.ItemsDAO.getAllItems(ItemsDAO.java:22)

at org.apache.jsp.index_jsp._jspService(index_jsp.java:117)

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:662)



** END NESTED EXCEPTION **




Last packet sent to the server was 11 ms ago.

at com.mysql.jdbc.Connection.createNewIO(Connection.java:2814)

at com.mysql.jdbc.Connection.<init>(Connection.java:1553)

at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)

at java.sql.DriverManager.getConnection(DriverManager.java:582)

at java.sql.DriverManager.getConnection(DriverManager.java:185)

at util.DBHelper.getConnection(DBHelper.java:34)

at dao.ItemsDAO.getAllItems(ItemsDAO.java:22)

at org.apache.jsp.index_jsp._jspService(index_jsp.java:117)

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:662)

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception: 


** BEGIN NESTED EXCEPTION ** 


java.net.ConnectException

MESSAGE: Connection refused: connect


STACKTRACE:


java.net.ConnectException: Connection refused: connect

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)

at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

at java.net.Socket.connect(Socket.java:529)

at java.net.Socket.connect(Socket.java:478)

at java.net.Socket.<init>(Socket.java:375)

at java.net.Socket.<init>(Socket.java:218)

at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:173)

at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:267)

at com.mysql.jdbc.Connection.createNewIO(Connection.java:2739)

at com.mysql.jdbc.Connection.<init>(Connection.java:1553)

at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)

at java.sql.DriverManager.getConnection(DriverManager.java:582)

at java.sql.DriverManager.getConnection(DriverManager.java:185)

at util.DBHelper.getConnection(DBHelper.java:34)

at dao.ItemsDAO.getAllItems(ItemsDAO.java:22)

at org.apache.jsp.index_jsp._jspService(index_jsp.java:117)

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:662)



** END NESTED EXCEPTION **




Last packet sent to the server was 1 ms ago.

at com.mysql.jdbc.Connection.createNewIO(Connection.java:2814)

at com.mysql.jdbc.Connection.<init>(Connection.java:1553)

at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)

at java.sql.DriverManager.getConnection(DriverManager.java:582)

at java.sql.DriverManager.getConnection(DriverManager.java:185)

at util.DBHelper.getConnection(DBHelper.java:34)

at dao.ItemsDAO.getAllItems(ItemsDAO.java:22)

at org.apache.jsp.index_jsp._jspService(index_jsp.java:117)

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:662)



正在回答

2 回答

  1. 数据库服务是否正常开启,就算开启了建议重启一次,MYSQL有时候会出现些问题。

  2. DBHELPER类中数据库登录用户名与密码是否正确

0 回复 有任何疑惑可以回复我~

21

123


0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
JAVA遇见HTML——Servlet篇
  • 参与学习       160615    人
  • 解答问题       1029    个

本门课程在JSP课程的基础上,深入介绍Servlet的基础知识

进入课程

帮忙看看报错?数据库连接不上报错?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信