I am getting below error while trying neo4j bolt driver to run simple cypher. Any idea what is going wrong?
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: Exception in thread "main" org.neo4j.driver.v1.exceptions.ClientException: Protocol error, server suggested unexpected protocol version: 1213486160 at org.neo4j.driver.internal.connector.socket.SocketClient.negotiateProtocol(SocketClient.java:198) at org.neo4j.driver.internal.connector.socket.SocketClient.start(SocketClient.java:73) at org.neo4j.driver.internal.connector.socket.SocketConnection.(SocketConnection.java:63) at org.neo4j.driver.internal.connector.socket.SocketConnector.connect(SocketConnector.java:52) at org.neo4j.driver.internal.pool.InternalConnectionPool$1.allocate(InternalConnectionPool.java:191) at org.neo4j.driver.internal.pool.InternalConnectionPool$1.allocate(InternalConnectionPool.java:180) at org.neo4j.driver.internal.pool.ThreadCachingPool.allocate(ThreadCachingPool.java:212) at org.neo4j.driver.internal.pool.ThreadCachingPool.acquireFromGlobal(ThreadCachingPool.java:164) at org.neo4j.driver.internal.pool.ThreadCachingPool.acquire(ThreadCachingPool.java:118) at org.neo4j.driver.internal.pool.InternalConnectionPool.acquire(InternalConnectionPool.java:109) at org.neo4j.driver.internal.InternalDriver.session(InternalDriver.java:53) at Neo4jMain.boldDriver(Neo4jMain.java:55) at Neo4jMain.main(Neo4jMain.java:30)
You're using the wrong port number. 7474 is by default used for http whereas 7687 is the default for binary bolt protocol.
An important hint is that 1213486160 is "HTTP" as a 32-bit big-endian number.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With