这是错误:
5760 feb 04 07:45:17 TestServer java[13777]: java.sql.SQLNonTransientConnectionException: Could not read resultset: unexpected end of stream, read 0bytes from 4
5761 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.internal.SQLExceptionMapper.get(SQLExceptionMapper.java:136)
5762 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.internal.SQLExceptionMapper.throwException(SQLExceptionMapper.java:106)
5763 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.MySQLStatement.executeQueryEpilog(MySQLStatement.java:264)
5764 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:288)
5765 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.MySQLStatement.executeUpdate(MySQLStatement.java:317)
5766 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.MySQLPreparedStatement.executeUpdate(MySQLPreparedStatement.java:156)
5767 feb 04 07:45:17 TestServer java[13777]: at com.zaxxer.hikari.proxy.PreparedStatementProxy.executeUpdate(PreparedStatementProxy.java:61)
5768 feb 04 07:45:17 TestServer java[13777]: at com.zaxxer.hikari.proxy.PreparedStatementJavassistProxy.executeUpdate(PreparedStatementJavassistProxy.java)
5769 feb 04 07:45:17 TestServer java[13777]: at com.testserver.deviceapi.data.DataDAO.insertBootEvent(DataDAO.java:64)
5770 feb 04 07:45:17 TestServer java[13777]: at com.testserver.deviceapi.server.ServerRunnable.processJsonObject(ServerRunnable.java:198)
5771 feb 04 07:45:17 TestServer java[13777]: at com.testserver.deviceapi.server.ServerRunnable.run(ServerRunnable.java:93)
5772 feb 04 07:45:17 TestServer java[13777]: at java.lang.Thread.run(Thread.java:745)
5773 feb 04 07:45:17 TestServer java[13777]: Caused by: org.mariadb.jdbc.internal.common.QueryException: Could not read resultset: unexpected end of stream, read 0bytes from 4
5774 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.internal.mysql.MySQLProtocol.getResult(MySQLProtocol.java:926)
5775 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.internal.mysql.MySQLProtocol.executeQuery(MySQLProtocol.java:991)
5776 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.MySQLStatement.execute(MySQLStatement.java:281)
5777 feb 04 07:45:17 TestServer java[13777]: ... 8 more
5778 feb 04 07:45:17 TestServer java[13777]: Caused by: java.io.EOFException: unexpected end of stream, read 0bytes from 4
5779 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.internal.common.packet.buffer.ReadUtil.readFully(ReadUtil.java:84)
5780 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.internal.common.packet.buffer.ReadUtil.readFully(ReadUtil.java:92)
5781 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.internal.common.packet.RawPacket.nextPacket(RawPacket.java:77)
5782 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.internal.common.packet.SyncPacketFetcher.getRawPacket(SyncPacketFetcher.java:67)
5783 feb 04 07:45:17 TestServer java[13777]: at org.mariadb.jdbc.internal.mysql.MySQLProtocol.getResult(MySQLProtocol.java:894)
5784 feb 04 07:45:17 TestServer java[13777]: ... 10 more
服务器是一个java服务器,在CentOS上作为服务运行。我昨天只将它作为一项服务实施,这是我第一次尝试做类似的事情。截至昨天晚上一切都很好。我已经从局域网测试了服务器并从局域网外部连接而没有任何问题,所有数据都得到了处理并成功保存。
以下是Javadoc对SQLNonTransientConnectionException
所说的内容:
为SQLState类值' 08'抛出SQLException的子类, 或在供应商指定的条件下。这表明了 如果操作是失败的连接操作将不会成功 在没有纠正失败原因的情况下重试。请 请参阅供应商指定的驱动程序供应商文档 可能引发此异常的条件。
Table 6. Class Code 08: Connection Exception SQLSTATE Value Meaning 08001 The connection was unable to be established to the application server or other server. 08002 The connection already exists. 08003 The connection does not exist. 08004 The application server rejected establishment of the connection.
所以我今天早上来到这里,并尝试在发生这些错误时使用我的测试客户端将一些数据保存到数据库中。经过几次尝试后,我在本地计算机上运行了服务器,完全相同的版本,并且它没有任何问题,成功连接到主服务器上的数据库,并从同一客户端保存相同的数据没有任何问题。
接下来,我在主服务器上重新启动了该服务。从那时起,一切都恢复正常,而且对于导致错误的事情,我并不聪明。
可能是this吗?
但该错误消息为Last packet not finished
,其中我的是Could not read resultset: unexpected end of stream, read 0bytes from 4
。
你们有什么想法吗? 我应该怎么处理? 由于错误清楚地表明问题不能在重试时解决,我认为我可以捕获错误并关闭服务器。该服务设置为立即重新启动,因此CentOS将在关闭后重新启动它。 这是合理的事吗?