首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法从spring-boot-starter-data-ne4j连接到云托管neo4j服务器

无法从spring-boot-starter-data-ne4j连接到云托管neo4j服务器
EN

Stack Overflow用户
提问于 2020-02-18 02:30:39
回答 1查看 392关注 0票数 2

我正在为一个项目使用neo4j,并且我已经运行了一个neo4j的谷歌云实例。使用螺栓协议,我可以通过neo4j浏览器与这个实例连接。在项目中,它可以在我的笔记本电脑上运行本地连接,但是当我在云实例的浏览器中使用相同的螺栓连接uri时,我得到了这个错误:

代码语言:javascript
复制
org.neo4j.driver.exceptions.ServiceUnavailableException: 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.

显然,这与加密设置有关。但是,在互联网上搜索了几个小时后,我还没有更接近这个解决方案。依赖项在gradle中管理,spring boot版本为2.2.4.RELEASE:

代码语言:javascript
复制
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'

runtimeOnly('org.springframework.cloud:spring-cloud-gcp-starter-sql-postgresql:1.2.1.RELEASE')
runtimeOnly('com.h2database:h2')

compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'

testImplementation('org.springframework.boot:spring-boot-starter-test')
implementation 'org.springframework.boot:spring-boot-starter-data-neo4j'
implementation 'org.springframework.boot:spring-boot-starter-data-rest'
implementation 'org.springframework.boot:spring-boot-devtools'
compile 'org.neo4j:neo4j:4.0.0'
compile 'org.neo4j:neo4j-ogm-bolt-driver'

application.properties看起来像这样

代码语言:javascript
复制
spring.data.neo4j.uri=bolt://34.76.157.40:7687
spring.data.neo4j.username=neo4j
spring.data.neo4j.password=******

我曾尝试将neo4j的版本调低,因为我们并不特别需要4.0.0,但这不起作用。我的项目中没有config类,这个问题与我相信的注解无关,因为它在本地工作。

有没有人遇到过同样的问题,或者可以帮上忙?

EN

回答 1

Stack Overflow用户

发布于 2021-11-04 20:20:35

对于我自己的应用程序,这花费了我相当多的时间来弄清楚。这就是对我有效的方法。

我在Aura和Spring Data neo4j 6.1.6上使用neo4j 4.3.0

在这种情况下,您需要将ne4j-java-driver-spring-boot-starter添加到Maven依赖项中:

代码语言:javascript
复制
<dependency>
    <groupId>org.neo4j.driver</groupId>
    <artifactId>neo4j-java-driver-spring-boot-starter</artifactId>
    <version>4.2.7.0</version>
</dependency>

然后在application.properties中配置驱动程序设置,如下所示:

代码语言:javascript
复制
org.neo4j.driver.uri=neo4j+s://xxxxxx.databases.neo4j.io
org.neo4j.driver.authentication.username=neo4j
org.neo4j.driver.authentication.password=your_password
org.neo4j.driver.config.encrypted=true

This的文章给我带来了解决方案。您还可以在那里找到旧版本和不同配置的信息。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60268504

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档