0

I successfully merged nodes using the following code:

session = cypher.Session('http://192.168.56.20:7474/db/data/')
txa = session.create_transaction()
txa.append("""
  MERGE (frame:FRAME {timestamp:{props}.ts})
  ON CREATE SET frame:FIRST_FRAME
  RETURN frame
""", props)
txa.commit()
result, = txa.commit()
frame, = result[0]

the logfile looks like this:

INFO:py2neo.packages.httpstream.http:>>> POST http://192.168.56.20:7474/db/data/transaction/commit [910]
DEBUG:py2neo.packages.httpstream.http:>>> Host: 192.168.56.20:7474
DEBUG:py2neo.packages.httpstream.http:>>> Content-Type: application/json
DEBUG:py2neo.packages.httpstream.http:>>> X-Stream: true;format=pretty
DEBUG:py2neo.packages.httpstream.http:>>> User-Agent: py2neo/1.6.1 HTTPStream/1.1.0          Python/2.7.5-final-0 (darwin)
INFO:py2neo.packages.httpstream.http:<<< 200 OK [chunked]
DEBUG:py2neo.packages.httpstream.http:<<< transfer-encoding: chunked
DEBUG:py2neo.packages.httpstream.http:<<< access-control-allow-origin: *
DEBUG:py2neo.packages.httpstream.http:<<< server: Jetty(9.0.5.v20130815)
DEBUG:py2neo.packages.httpstream.http:<<< content-type: application/json
DEBUG:py2neo.packages.httpstream.http:<<< content-encoding: UTF-8

And the result variable returned is:

[Record(columns=(u'frame',), values=(Node('http://0.0.0.0:7474/db/data/node/24'),))]

Notice the wrong uri (0.0.0.0)

when I try to use the returned node instance a Connection Exception is thrown. ie:

frame.remove_labels('FIRST_FRAME')

py2neo.packages.httpstream.http.SocketError: Connection refused

By the logged trace I can see it tried to get the data from the wrong server:

INFO:py2neo.packages.httpstream.http:>>> GET http://0.0.0.0:7474/db/data/node/24/properties

What am I doing wrong?

Fernando Ferreira
  • 798
  • 1
  • 11
  • 26

2 Answers2

2

That's certainly an odd response - I assume you're not using the rewrite function anywhere in your code? If so, check its configuration, if not there are a couple of other things you can try:

  1. Do you have a layer in front of your server acting as a proxy? This is often used to apply authentication or similar. If so, try bypassing this and going straight to the server to see if you still get the problem.
  2. Try carrying out the same request using cURL from the command line to see the raw response. This can help confirm at what level the 0.0.0.0 is becoming substituted.
Nigel Small
  • 4,475
  • 1
  • 17
  • 15
  • you assumed correct, I'm not using the rewrite feature. Abou proxy, the neo4j server is currently under a virtualbox machine. I'm using a NAT adapter (for accessing the internet) and a host-only adapter to fake a internet network. Do you think this affects the usage? I'm not able to used the network interface as bridge mode. – Fernando Ferreira Jan 17 '14 at 11:49
  • It's hard to say conclusively but it's reasonably likely this is affecting it. I would definitely try running some cURL commands from your host machine against the DB in your guest VM and examine the headers and payloads exchanged to look for anomalies. – Nigel Small Jan 17 '14 at 11:58
0

I ran into this same issue and it turned out to be due to the Neo4j server config.

http://docs.neo4j.org/chunked/stable/server-configuration.html

I had:

#allow any client to connect
org.neo4j.server.webserver.address=0.0.0.0

which needed to be the actual IP address you use from Py2Neo:

#allow any client to connect
org.neo4j.server.webserver.address=real-ip-here (192.168.56.20 in your example)
dvingo
  • 73
  • 5