做串口通讯时出现的异常。

 


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

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: java.net.BindException: Address already in use: connect

STACKTRACE:

java.net.SocketException: java.net.BindException: Address already in use: connect
 at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
 at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
 at com.mysql.jdbc.Connection.createNewIO(Connection.java:2641)
 at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
 at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
 at java.sql.DriverManager.getConnection(Unknown Source)
 at java.sql.DriverManager.getConnection(Unknown Source)
 at com.item.dao.DBConnection.getConn(Unknown Source)
 at com.item.dao.MessageDAO.selectNid(Unknown Source)
 at com.item.servlet.DataServlet.update(Unknown Source)
 at java.util.Observable.notifyObservers(Unknown Source)
 at com.item.comm.SerialReader.changeMessage(Unknown Source)
 at com.item.comm.SerialReader.serialEvent(Unknown Source)
 at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732)
 at gnu.io.RXTXPort.eventLoop(Native Method)
 at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575)


** END NESTED EXCEPTION **

 

Last packet sent to the server was 0 ms ago.
 at com.mysql.jdbc.Connection.createNewIO(Connection.java:2707)
 at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
 at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
 at java.sql.DriverManager.getConnection(Unknown Source)
 at java.sql.DriverManager.getConnection(Unknown Source)
 at com.item.dao.DBConnection.getConn(Unknown Source)
 at com.item.dao.MessageDAO.selectNid(Unknown Source)
 at com.item.servlet.DataServlet.update(Unknown Source)
 at java.util.Observable.notifyObservers(Unknown Source)
 at com.item.comm.SerialReader.changeMessage(Unknown Source)
 at com.item.comm.SerialReader.serialEvent(Unknown Source)
 at gnu.io.RXTXPort.sendEvent(RXTXPort.java:732)
 at gnu.io.RXTXPort.eventLoop(Native Method)
 at gnu.io.RXTXPort$MonitorThread.run(RXTXPort.java:1575)
com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: java.net.BindException: Address already in use: connect

STACKTRACE:

java.net.SocketException: java.net.BindException: Address already in use: connect
 at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
 at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
 at com.mysql.jdbc.Connection.createNewIO(Connection.java:2641)
 at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
 at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
 at java.sql.DriverManager.getConnection(Unknown Source)
 at java.sql.DriverManager.getConnection(Unknown Source)
 at com.item.dao.DBConnection.getConn(Unknown Source)
 at com.item.dao.NumberDAO.selectZT(Unknown Source)
 at org.apache.jsp.selectns_jsp._jspService(selectns_jsp.java:97)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
 at com.item.servlet.MessageServlet.doSelect(Unknown Source)
 at com.item.servlet.MessageServlet.doPost(Unknown Source)
 at com.item.servlet.MessageServlet.doGet(Unknown Source)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
 at com.item.servlet.MessageServlet.doUpdate(Unknown Source)
 at com.item.servlet.MessageServlet.doPost(Unknown Source)
 at com.item.servlet.MessageServlet.doGet(Unknown Source)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at com.item.servlet.FourmChainValidate.doFilter(Unknown Source)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 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:175)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Unknown Source)


** END NESTED EXCEPTION **

 

Last packet sent to the server was 0 ms ago.
 at com.mysql.jdbc.Connection.createNewIO(Connection.java:2707)
 at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
 at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
 at java.sql.DriverManager.getConnection(Unknown Source)
 at java.sql.DriverManager.getConnection(Unknown Source)
 at com.item.dao.DBConnection.getConn(Unknown Source)
 at com.item.dao.NumberDAO.selectZT(Unknown Source)
 at org.apache.jsp.selectns_jsp._jspService(selectns_jsp.java:97)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
 at com.item.servlet.MessageServlet.doSelect(Unknown Source)
 at com.item.servlet.MessageServlet.doPost(Unknown Source)
 at com.item.servlet.MessageServlet.doGet(Unknown Source)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
 at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
NullPointerException744444.
java.lang.NullPointerException
aaaaaaaaaaaaaaaaaaaaa
 at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
 at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
 at com.item.servlet.MessageServlet.doUpdate(Unknown Source)
 at com.item.servlet.MessageServlet.doPost(Unknown Source)
 at com.item.servlet.MessageServlet.doGet(Unknown Source)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at com.item.servlet.FourmChainValidate.doFilter(Unknown Source)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 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:175)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Unknown Source)
selectZT报错。

 

报了一些连接错误的问题。原因就是因为连接过于频繁。用jdbc连接顶不住。用上连接池就搞定了

你可能感兴趣的:(做串口通讯时出现的异常。)