我有一个在docker容器中运行的spring boot应用程序的jar。我正在尝试将它连接到一个neo4j docker容器。当我命中url http://localhost:8080/“无法打开事务的Neo4j会话”时,我得到了一个错误。但是,当我从两台不同的机器上运行jar和neo4j容器时,它会连接到neo4j数据库。只有当我在同一台主机上运行两个容器时才会发生错误。日志如下:
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]
https://stackoverflow.com/questions/54866600
复制相似问题