title: Connection refused from neo4j docker container
body: <p>I have a jar of a spring boot application running in a docker container. I am trying to connect it to a neo4j docker container. I get an error when I hit the url <a href="http://localhost:8080/" rel="nofollow noreferrer">http://localhost:8080/</a> "Could not open Neo4j Session for transaction". But when I run the jar and neo4j container from two separate machines it connects to the neo4j db. Error only occurs if I run both containers on same host machine. Below is the log:</p>
  
  <pre><code>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]
  </code></pre>