我正在尝试连接到Neo4j,但一直收到此错误。我试过了
from neo4j.v1 import GraphDatabase
driver = GraphDatabase.driver(uri="bolt://localhost:7687", auth=("neo4j", "12345"))
字符串
但是当我尝试连接的时候我得到这个错误
安全错误:无法建立与“EOF违反协议(_ssl.c:841)”的安全连接
输入http://localhost:7474/browser/时可以连接到浏览器
以下是完整的错误日志:
- SSLEOFError Traceback(most recent call last)~\AppData\Roaming\Python\Python36\site-packages\neobolt\direct.py in secure(s,host,ssl_context,config)853 try:--> 854 s = ssl_context.wrap_socket(s,server_hostname=host if HAS_SNI and host else None)855 except SSLError as cause:
c:\program files\python36\lib\ssl.py in wrap_socket(self,sock,server_side,do_handshake_on_connect,suppress_ragged_eofs,server_hostname,session)406 server_hostname=server_hostname,--> 407 _context=self,_session=session)408
c:\program files\python36\lib\ssl.py ininit**(self,sock,keyfile,certfile,server_side,cert_reqs,ssl_version,ca_certs,do_handshake_on_connect,family,type,proto,fileno,suppress_ragged_eofs,npn_protocols,ciphers,server_hostname,context,session)813 raise ValueError(“do_handshake_on_connect should not be specified for non-blocking sockets”)--> 814 self.do_handshake()815
c:\program files\python36\lib\ssl.py in do_handshake(self,block)
1067 self.settimeout(None)-> 1068 self.sslobj.do_handshake()
c:\program files\python36\lib\ssl.py in do_handshake(self)688“开始SSL/TLS握手。"--> 689 self.sslobj.do_handshake()690 if self.context.check_hostname:
SSLEOF错误:EOF违反了方案(ssl.c:841)
上述异常是以下异常的直接原因:
1 ----> 2 driver = GraphDatabase.driver(uri=“bolt://localhost:7687”,auth=(“neo4j”,“12345”)中的SecurityError Traceback(most recent call last)
~\AppData\Roaming\Python\Python36\site-packages\neo4j__init.py in driver(cls,uri,**config)118:class:.Driver
子类示例。119“"”--> 120 return Driver(uri,**config)121 122
~\AppData\Roaming\Python\Python36\site-packages\neo4j__init.py innew(cls,uri,**config)159 for subclass in Driver.subclasses():160如果parsed_scheme在子类.uri_schemes中:--> 161 return subclass(uri,**config)162 raise ValueError(“URI scheme %r not supported”% parsed.scheme)163
2019 - 05 - 22 01:01:00:00 ~ 2019 - 05 - 22 01:00 ~ 2019 - 05:00 ~ 2019 - 05:00 ~ 2019:00 ~ 2019 - 05:00:00 ~ 201
~\AppData\Roaming\Python\Python36\site-packages\neobolt\direct.py in acquire(self,access_mode)713 714 def acquire(self,access_mode=None):--> 715返回self.acquire_direct(self.address)716 717
~\AppData\Roaming\Python\Python36\site-packages\neobolt\direct.py in acquire_direct(self,address)606 if can_create_new_connection:607 try:--> 608 connection = self.connector(address,error_handler=self.connection_error_handler)610 self.remove(address)
~\AppData\Roaming\Python\Python36\site-packages\neo4j__init.py in connector(address,**kwargs)230 231 def connector(address,**kwargs):--> 232 return connect(address,**dict(config,**kwargs))233 234 pool = ConnectionPool(connector,instance.address,**config)
~\AppData\Roaming\Python\Python36\site-packages\neobolt\direct.py in connect(address,**config)970 raise ServiceUnavailable(“Failed to resolve addresses for %s”% address)971 else:--> 972 raise last_error
~\AppData\Roaming\Python\Python36\site-packages\neobolt\direct.py in connect(address,**config)961 host = address[0] 962 s = _connect(resolved_address,**config)--> 963 s,der_encoded_server_certificate = _secure(s,host,security_plan.ssl_context,**config)964 connection = _handshake(s,address,der_encoded_server_certificate,**config)965 except Exception as error:
~\AppData\Roaming\Python\Python36\site-packages\neobolt\direct.py in _secure(s,host,ssl_context,**config)857 error = SecurityError(“无法建立安全连接到{!r}".format(cause.args[1]))858 error.cause= cause --> 859 raise error 860 else:861 #检查服务器是否提供证书
安全错误:无法建立与“EOF违反协议(_ssl.c:841)”的安全连接
4条答案
按热度按时间zpgglvta1#
我为可能有同样问题的人找到了解决方案。您需要添加
encrypted=False
。而不是
字符串
它应该是:
型
希望这能帮助到一些人
t98cgbkg2#
我在使用对象图Map器Neomodel(连接到neo4j v4)时也遇到了同样的问题。添加第二行解决了这个问题:
字符串
8ehkhllq3#
我也有同样的问题,但是Sam的回答并没有解决问题。正在使用
字符串
我得到错误
SyntaxError: positional argument follows keyword argument
直接在命令中输入
uri
,如下所示:driver = GraphDatabase.driver( encrypted=False, uri = "bolt://localhost:7687", auth=('neo4j', 'asdf'))
导致另一个错误(SecurityError: Failed to establish secure connection to '[SSL: KRB5_S_TKT_NYV] unexpected eof while reading (_ssl.c:1076)'
)然而,当遵循post in the neo4j community时,它们将参数的位置切换为:
型
它就像一种魔力。
ogq8wdun4#
这是为我工作,加密作为附加参数。
字符串