2017  Kodetalk | Feedback | Privacy Policy | Terms | About
userimage

Getting exception while connection with neo4j 3.0.2 using neo4j-java-driver

Hi,
I have installed neo4j 3.0.2 in my windows 10 and configure the database storage path and imported some dummy data. It was running well and when i stopped the neo4j database cleaned the the database path and trying to connect from java code i am getting this exception. What could be the reason and how to solve it.


The exception i am getting is as below:

Exception in thread "main" org.neo4j.driver.v1.exceptions.ClientException: Unable to process request: General SSLEngine problem
    at org.neo4j.driver.internal.connector.socket.SocketClient.start(SocketClient.java:86)
    at org.neo4j.driver.internal.connector.socket.SocketConnection.<init>(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:230)
    at org.neo4j.driver.internal.pool.ThreadCachingPool.acquireFromGlobal(ThreadCachingPool.java:166)
    at org.neo4j.driver.internal.pool.ThreadCachingPool.acquire(ThreadCachingPool.java:119)
    at org.neo4j.driver.internal.pool.InternalConnectionPool.acquire(InternalConnectionPool.java:109)
    at org.neo4j.driver.internal.InternalDriver.session(InternalDriver.java:53)
    at com.connection.Neo4jConnections.main(Neo4jConnections.java:49)
Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
    at sun.security.ssl.Handshaker.checkThrown(Handshaker.java:1431)
    at sun.security.ssl.SSLEngineImpl.checkTaskThrown(SSLEngineImpl.java:535)
    at sun.security.ssl.SSLEngineImpl.writeAppRecord(SSLEngineImpl.java:1214)
    at sun.security.ssl.SSLEngineImpl.wrap(SSLEngineImpl.java:1186)
    at javax.net.ssl.SSLEngine.wrap(SSLEngine.java:469)
    at org.neo4j.driver.internal.connector.socket.TLSSocketChannel.wrap(TLSSocketChannel.java:270)
    at org.neo4j.driver.internal.connector.socket.TLSSocketChannel.runHandshake(TLSSocketChannel.java:131)
    at org.neo4j.driver.internal.connector.socket.TLSSocketChannel.<init>(TLSSocketChannel.java:95)
    at org.neo4j.driver.internal.connector.socket.TLSSocketChannel.<init>(TLSSocketChannel.java:77)
    at org.neo4j.driver.internal.connector.socket.TLSSocketChannel.<init>(TLSSocketChannel.java:70)
    at org.neo4j.driver.internal.connector.socket.SocketClient$ChannelFactory.create(SocketClient.java:235)
    at org.neo4j.driver.internal.connector.socket.SocketClient.start(SocketClient.java:72)
    ... 10 more
Caused by: javax.net.ssl.SSLHandshakeException: General SSLEngine problem
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
    at sun.security.ssl.SSLEngineImpl.fatal(SSLEngineImpl.java:1728)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:304)
    at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:296)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1497)
    at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:212)
    at sun.security.ssl.Handshaker.processLoop(Handshaker.java:979)
    at sun.security.ssl.Handshaker$1.run(Handshaker.java:919)
    at sun.security.ssl.Handshaker$1.run(Handshaker.java:916)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.security.ssl.Handshaker$DelegatedTask.run(Handshaker.java:1369)
    at org.neo4j.driver.internal.connector.socket.TLSSocketChannel.runDelegatedTasks(TLSSocketChannel.java:142)
    at org.neo4j.driver.internal.connector.socket.TLSSocketChannel.unwrap(TLSSocketChannel.java:203)
    at org.neo4j.driver.internal.connector.socket.TLSSocketChannel.runHandshake(TLSSocketChannel.java:127)
    ... 15 more
Caused by: java.security.cert.CertificateException: Unable to connect to neo4j at `127.0.0.1:7687`, because the certificate the server uses has changed. This is a security feature to protect against man-in-the-middle attacks.
If you trust the certificate the server uses now, simply remove the line that starts with `127.0.0.1:7687` in the file `C:UsersDeb.neo4jknown_hosts`.
The old certificate saved in file is:
-----BEGIN CERTIFICATE-----
e45f8cb04b3ceb7c479cd9f28ad08168c22b7bea5c3320d8ead6f93e4488a77a
f915e6ada529182eb22b285d251da349eaa3d183ffa8304244c70898e27d838e

-----END CERTIFICATE-----
The New certificate received is:
-----BEGIN CERTIFICATE-----
020ddd046c8ca062e725963e3d6dca1ab5834305223495c3b9c57073ccb91c2c
292ff3f0d75adb469e3cc21024081adfecc942816716fb42b5c963682a6ca5f0

-----END CERTIFICATE-----

    at org.neo4j.driver.internal.connector.socket.TrustOnFirstUseTrustManager.checkServerTrusted(TrustOnFirstUseTrustManager.java:153)
    at sun.security.ssl.AbstractTrustManagerWrapper.checkServerTrusted(SSLContextImpl.java:936)
    at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1484)
    ... 24 more

userimage
The problem here is, you have not deleted the .neo4j folder from user path [c:User<PCname>]. Once you try to delete the .neo4j folder from user path and clean the database path. Once all done try the same your problem will resolve.
Answer is