gpt4 book ai didi

Neo4j bolt 驱动程序协议(protocol)错误

转载 作者:行者123 更新时间:2023-12-04 16:38:56 25 4
gpt4 key购买 nike

我在尝试 neo4j bolt 驱动程序运行简单密码时遇到错误。知道出了什么问题吗?

    public void boltDriver() {
Config noSSL = Config.build()
.withEncryptionLevel(Config.EncryptionLevel.NONE).toConfig();
Driver driver = GraphDatabase.driver("bolt://localhost:7474",
AuthTokens.basic("neo4j", "neo4j1"), noSSL); // <password>

try (Session session = driver.session()) {

StatementResult result;

String foafQuery = " MATCH (n) WHERE EXISTS(n.country) RETURN DISTINCT \"node\" as element, n.country AS country ";
result = session.run(foafQuery, parameters("name", "Joe"));
while (result.hasNext()) {
Record next = result.next();
System.out.println(next.get("element"));
System.out.println(next.get("country"));
}

}

}

异常(exception):
线程“主”org.neo4j.driver.v1.exceptions.ClientException 中的异常:协议(protocol)错误,服务器建议意外协议(protocol)版本:1213486160
在 org.neo4j.driver.internal.connector.socket.SocketClient.negotiateProtocol(SocketClient.java:198)
在 org.neo4j.driver.internal.connector.socket.SocketClient.start(SocketClient.java:73)
在 org.neo4j.driver.internal.connector.socket.SocketConnection.(SocketConnection.java:63)
在 org.neo4j.driver.internal.connector.socket.SocketConnector.connect(SocketConnector.java:52)
在 org.neo4j.driver.internal.pool.InternalConnectionPool$1.allocate(InternalConnectionPool.java:191)
在 org.neo4j.driver.internal.pool.InternalConnectionPool$1.allocate(InternalConnectionPool.java:180)
在 org.neo4j.driver.internal.pool.ThreadCachingPool.allocate(ThreadCachingPool.java:212)
在 org.neo4j.driver.internal.pool.ThreadCachingPool.acquireFromGlobal(ThreadCachingPool.java:164)
在 org.neo4j.driver.internal.pool.ThreadCachingPool.acquire(ThreadCachingPool.java:118)
在 org.neo4j.driver.internal.pool.InternalConnectionPool.acquire(InternalConnectionPool.java:109)
在 org.neo4j.driver.internal.InternalDriver.session(InternalDriver.java:53)
在 Neo4jMain.boldDriver(Neo4jMain.java:55)
在 Neo4jMain.main(Neo4jMain.java:30)

最佳答案

您使用了错误的端口号。默认情况下,7474 用于 http,而 7687 是二进制 bolt 协议(protocol)的默认值。

关于Neo4j bolt 驱动程序协议(protocol)错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37128583/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com