当前位置: 首页 > 知识库问答 >
问题:

从Micronaut Java应用程序访问Heroku上的neo4j/graphenedb(免开发计划)失败:与数据库的连接终止

郁鸿博
2023-03-14

目前,我正在Heroku平台上与Neo4J/Graphenedb(免开发计划)作斗争。通过“Heroku Local”在本地启动我的应用程序很好,它将(Neo4j Java Driver 4)连接到Neo4j 3.5.18(从Docker映像“Neo4j:3.5”运行)。

INFO  Driver - Direct driver instance 1523082263 created for server address hobby-[...]ldel.dbs.graphenedb.com:24787
WARN  RetryLogic - Transaction failed and will be retried in 1032ms
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.
 at org.neo4j.driver.internal.util.Futures.blockingGet(Futures.java:143)
 at org.neo4j.driver.internal.InternalSession.beginTransaction(InternalSession.java:163)
 at org.neo4j.driver.internal.InternalSession.lambda$transaction$4(InternalSession.java:147)
 at org.neo4j.driver.internal.retry.ExponentialBackoffRetryLogic.retry(ExponentialBackoffRetryLogic.java:101)
 at org.neo4j.driver.internal.InternalSession.transaction(InternalSession.java:146)
 at org.neo4j.driver.internal.InternalSession.readTransaction(InternalSession.java:112)
 at org.neo4j.driver.internal.InternalSession.readTransaction(InternalSession.java:106)
 at PersonController.logInfoOf(PersonController.java:57)
 at PersonController.<init>(PersonController.java:50)
 at $PersonControllerDefinition.build(Unknown Source)
 at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1814)
 [...]
 at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 at java.base/java.lang.Thread.run(Thread.java:832)
Suppressed: org.neo4j.driver.internal.util.ErrorUtil$InternalExceptionCause: null
 at org.neo4j.driver.internal.util.ErrorUtil.newConnectionTerminatedError(ErrorUtil.java:52)
 at org.neo4j.driver.internal.async.connection.HandshakeHandler.channelInactive(HandshakeHandler.java:81)
 [...]
 at org.neo4j.driver.internal.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
 at org.neo4j.driver.internal.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
 ... 1 common frames omitted

我肯定会从正确注入应用程序的OS环境变量GRAPHENEDB_BOLT_URL、GRAPHENEDB_BOLT_USER和GRAPHENEDB_BOLT_PASSWORD中获得登录凭据;我已经用一些调试日志语句验证了它:

State changed from starting to up
INFO  io.micronaut.runtime.Micronaut - Startup completed in 2360ms. Server Running: http://localhost:7382
INFO  Application - Neo4j Bolt URIs: [bolt://hobby-[...]ldel.dbs.graphenedb.com:24787]
INFO  Application - Neo4j Bolt encrypted? false
INFO  Application - Neo4j Bolt trust strategy: TRUST_SYSTEM_CA_SIGNED_CERTIFICATES
INFO  Application - Changed trust strategy to: TRUST_ALL_CERTIFICATES
INFO  Application - Env.: GRAPHENEDB_BOLT_URL='bolt://hobby-[...]ldel.dbs.graphenedb.com:24787'
INFO  Application - Env.: GRAPHENEDB_BOLT_USER='app1[...]hdai'
INFO  Application - Env.: GRAPHENEDB_BOLT_PASSWORD of length 31

我也尝试过通过Heroku插件网站重启GrapheneDB实例,但也有同样的负面结果。

这里出什么问题了?有什么办法可以进一步确定根本原因吗?

共有1个答案

金嘉
2023-03-14

我仔细看了一下这个,似乎你需要为石墨烯db实例打开驱动程序加密。这可以在application.yml中进行配置,如下所示:

neo4j:
    encryption: true

下面是一个示例项目https://github.com/aldrinm/micronaut-neo4j-heroku以供参考

 类似资料:
  • 我刚刚在Heroku中创建了一个新的公关应用程序,添加了GrapheneDB。 null Python 3.6.5 Neo4J-Driver 1.5.3

  • 我在MySQL上有2个数据库。ge和GE_SC001。 我可以通过我的ASP.NET mvc应用程序在本地访问这两个。 Web.config null 稍后,当我在web服务器上部署应用程序,并尝试从本地机器访问它们时。我将server=localhost更改为机器的面向外部的IP地址。现在我只能访问一个GE。当我尝试访问第二个时,它会给我错误。 拒绝用户“root”@“对数据库”GE_SC001

  • 我在连接到公共托管的静态IP mysql服务器时遇到了一个奇怪的问题。 我能够使用MySQL Workbench成功连接到服务器,也可以通过SSH连接到本地远程服务器。但是从jdbc连接器连接到mysql服务器的尝试(通过NetBeans和本地部署的代码都失败)。在查看日志时,代码正在尝试与远程服务器连接,考虑到用户凭据是本地用户而不是远程用户的。因此用户存在于远程,但java在尝试连接时会考虑u

  • 问题内容: 我已经创建了我的应用程序并在Windows下对其进行了测试,该Windows可以在Access DB文件中进行读写操作。 但是在现实世界中,它将在linux环境中运行,而我现在遇到了一个大问题,似乎没有用于Linux的驱动程序来访问ms acess db,这是我现在进行连接的方式: 有没有人遇到过类似的事情,有人建议我该怎么办? 这是我在linux上得到的例外: 问题答案: 在Linu

  • 我们有一个基于微服务的系统,其中一个专用服务对MySQL执行所有与数据库相关的调用(db reader)。 在对< code>db-reader服务的其他服务中不时出现断路错误。 我们发现在此期间发生了Hikari池连接关闭/打开操作。 08:39:25.312 2022-03-28 08:39:25,311 [HikariPool-19 连接关闭] DEBUG com.zaxxer.hikari

  • 我试图连接到我的mongo数据库在我的远程服务器: 但我有一个错误: MongoDB外壳版本:2.6.10连接到:xxx。xxx。xxx。xx:27017/测试2016-11-07T05:18:39.140 0000警告:无法连接到xxx。xxx。xxx。xx:27017,原因:错误号:111连接被拒绝2016-11-07T05:18:39.142 0000错误:无法连接到服务器xxx。xxx。x