cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

Spring boot embedded neo4j: not able to connect from client when in docker container

saritatewari4
Node Link

Hello all, I upgraded one of my spring boot application from java 8 . I was using spring boot version 2.1.5.RELEASE previously with these all dependencies:

 

 

 <maven.compiler.source>1.8</maven.compiler.source>
 <maven.compiler.target>1.8</maven.compiler.target> 
 <neo4j.version>3.5.20</neo4j.version>
 <neo4j-ogm-core.version>3.1.9</neo4j-ogm-core.version>
 <neo4j-ogm-api.version>3.1.8</neo4j-ogm-api.version>
 <neo4j-ogm-embedded-driver.version>3.1.9</neo4j-ogm-embedded-driver.version> 
 <liquigraph.version>3.1.2</liquigraph.version>
 <lombok.version>1.18.8</lombok.version>
 <spring-data-neo4j.version>5.3.1.RELEASE</spring-data-neo4j.version>
 <spring-boot-starter.version>2.1.5.RELEASE</spring-boot-starter.version>
 <spring-boot-starter-test.version>2.1.5.RELEASE</spring-boot-starter-test.version>

 

 

Now upgraded that to java 11 with spring boot version 2.3.3.RELEASE with these dependencies:

 

<java.version>11</java.version>
<neo4j.version>4.2.4</neo4j.version>
<neo4j-ogm-core.version>3.2.32</neo4j-ogm-core.version>
<neo4j-ogm-api.version>3.2.32</neo4j-ogm-api.version>
<liquigraph.version>4.0.2</liquigraph.version>
<lombok.version>1.18.8</lombok.version>
<spring-data-neo4j.version>5.3.3.RELEASE</spring-data-neo4j.version>
<spring-boot-starter.version>2.3.3.RELEASE</spring-boot-starter.version>
<spring-boot-starter-test.version>2.3.3.RELEASE</spring-boot-starter-test.version>

 

I am running embedded neo4j on spring-boot application. It's working fine when running in local. I am not able to connect to database from client server and I am getting this error when server is running on docker container:

 

Connection to the database terminated. Please ensure that your database is listening on the correct host and port and that you have compatible encryption settings both on Neo4j server and driver. Note that the default encryption setting has changed in Neo4j 4.0.

 

It was working fine with previous dependency tree with java 8 version. To add on , I am getting this error on neo4j desktop:

 

ServiceUnavailable: WebSocket connection failure. Due to security constraints in your web browser, the reason for the failure is not available to this Neo4j Driver. Please use your browsers development console to determine the root cause of the failure. Common reasons include the database being unavailable, using the wrong connection URL or temporary network problems. If you have enabled encryption, ensure your browser is configured to trust the certificate Neo4j is configured to use. WebSocket readyState is: 3

 

Client side this is my code snippet:

 

 

Config config = Config.builder()
                .withoutEncryption()
                .build();
driver = GraphDatabase.driver( uri, config );

 

 

and on the server side this is how I am connecting to embedded Neo4J instance: :

 

 

DatabaseManagementService managementService = new DatabaseManagementServiceBuilder(databaseDirectory.getCanonicalFile())
                .setConfig(GraphDatabaseSettings.allow_upgrade, true)
                .setConfig(GraphDatabaseSettings.default_database, neo4jProperties.getDbName())
                .setConfig(BoltConnector.encryption_level, BoltConnector.EncryptionLevel.DISABLED)
                .setConfig(BoltConnector.enabled, true)
                .setConfig(BoltConnector.listen_address,
                        new SocketAddress(neo4jProperties.getListeningAddress()))
                .build();

 

 

 

 

 

2 REPLIES 2

TrevorS
Community Team
Community Team

Hello @saritatewari4 

I would recommend opening a ticket here for this issue.

Please post a link to your GitHub ticket here so others can track the progress of this issue.

Thanks!

TrevorS
Community Specialist

saritatewari4
Node Link

Hello @TrevorS , Thanks for your response. I have created the ticket. Sharing it for visibility.