1

I am new with neo4j when I wrote this code I got the following error:

>>> from py2neo import neo4j
>>> graph_DB = neo4j.GraphDatabaseService ("http://localhost:7474/db/data")

Traceback (most recent call last):
   File "<pyshell#1>", line 1, in <module>
      graph_DB = neo4j.GraphDatabaseService ("http://localhost:7474/db/data")
   File "C:\Python27\lib\site-packages\py2neo\neo4j.py", line 557, in __init__
      rs = self._send(rest.Request(self, "GET", self._uri))
   File "C:\Python27\lib\site-packages\py2neo\rest.py", line 372, in _send
      raise SocketError(err)
SocketError: error(10061, 'No connection could be made because the target machine actively refused it')

I use windows 7. I have done several search and find out that I must open port 7474 to use it in windows firewall with advance security but when I create a new rule in inbound rules this don't effect to that port. Also in ubuntu 10.10 I can't open the port using netcat:

nc -l 7474

Where am I wrong ? thank you

dreamcrash
  • 47,137
  • 25
  • 94
  • 117
zeroman
  • 11
  • 1
  • 3
  • You might have a (very) strict local firewall. Try `telnet localhost 7474` on Ubuntu. I don't know what you should do on Windows. – timss Apr 19 '13 at 16:11
  • Connecting To localhost...Could not open connection to the host, on port 7474: Connect failed – zeroman Apr 19 '13 at 16:12
  • That means there's nothing accepting connections on port 7474 on the given host (localhost). I.e. the SocketError may be correct. – timss Apr 19 '13 at 16:15
  • then how can i correct this in code ? – zeroman Apr 19 '13 at 16:16
  • Sorry, what I said isn't correct if you have a local firewall blocking it. For more information see [What can be the reasons of connection refused errors?](http://stackoverflow.com/questions/2333400/what-can-be-the-reasons-of-connection-refused-errors) - [Here's an example](http://i.imgur.com/H8haPA7.png) of what should happen if it works. – timss Apr 19 '13 at 16:20
  • thanks but the problem already exists ! :( – zeroman Apr 19 '13 at 16:27
  • maybe use `"http://127.0.0.1:7474/db/data"`? – Evgenii Apr 23 '13 at 09:13

1 Answers1

1

By default, Neo4J restrict the access to only 127.0.0.1 (localhost), however, you can change this option. inside "conf" folder find "neo4j-server.properties" and open this file with notepad.

Look for the following:

# Let the webserver only listen on the specified IP. Default is localhost (only
# accept local connections). Uncomment to allow any connection. Please see the
# security section in the neo4j manual before modifying this.
# org.neo4j.server.webserver.address=0.0.0.0

Uncomment the last line (remove the # sign) to allow access from EVERYWHERE (0.0.0.0). Optionally set the IP to only allow access from your web server.

Micha Kaufman
  • 777
  • 7
  • 11