【发布时间】:2021-10-26 00:13:34
【问题描述】:
我们正在使用 Spring Data Neo4j。所有查询都有效,但有时会引发异常:
org.springframework.dao.TransientDataAccessResourceException: Connection to the database failed; Error code 'N/A'; nested exception is org.neo4j.driver.exceptions.ServiceUnavailableException: Connection to the database failed
Caused by: java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[na:1.8.0_212]
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[na:1.8.0_212]
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[na:1.8.0_212]
一段时间后它会恢复连接。
如何解决此问题以立即恢复连接?
【问题讨论】:
-
只是一个想法,因为没有太多上下文:您是否在查询执行后消费结果?可能是您在对它们进行后处理之前已经关闭了打开的结果。因此,调用
consume()、list()或类似方法以尽快将结果水合可能是一个解决方案。
标签: java spring spring-boot neo4j spring-data-neo4j