我在docker容器中运行着一罐spring boot应用程序。我正在尝试将其连接到neo4j docker容器。当我点击网址http://localhost:8080/“无法打开Neo4j会话进行交易”时,我得到一个错误。但是,当我从两台单独的机器上运行jar和neo4j容器时,它将连接到neo4j db。仅当我在同一主机上运行两个容器时,才会发生错误。下面是日志:
2019-02-25 09:02:52.413 ERROR 6 --- [nio-8080-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.transaction.CannotCreateTransactionException: Could not open Neo4j Session for transaction; nested exception is org.neo4j.ogm.exception.ConnectionException: Could not create driver instance] with root cause
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_111]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_111]
at org.neo4j.driver.internal.shaded.io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:325) ~[neo4j-java-driver-1.6.3.jar!/:1.6.3-b33d284ef6f350edbfe9e8f4539cdcdb0200bd0b]