Neo4j Docker容器拒绝连接

时间:2019-02-25 12:49:14

标签: spring-boot docker neo4j jar

我在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]

1 个答案:

答案 0 :(得分:0)

不要将数据库绑定到本地主机。 绑定到任何IP 0.0.0.0 请阅读我的回答herehere。对遇到同样问题的人有帮助