使用 Neo4j 的 Hibernate OGM - 与服务器的应用程序连接失败
Hibernate OGM with Neo4j - Application conncetion to server failed
我正在尝试使用 hibernate ogm 连接到我正在 运行 使用本地计算机上的 docker 的 neo4j 服务器。
当我尝试连接时收到消息:
Exception in thread "main" javax.persistence.PersistenceException: Unable to build entity manager factory
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:66)
at org.hibernate.ogm.jpa.HibernateOgmPersistence.createEntityManagerFactory(HibernateOgmPersistence.java:59)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
at base.service.NoRelationshipTestsService.<init>(NoRelationshipTestsService.java:14)
at base.Main.main(Main.java:13)
Caused by: org.hibernate.service.spi.ServiceException: OGM000071: Unable to start datastore provider
at org.hibernate.ogm.datastore.neo4j.remote.bolt.impl.BoltNeo4jDatastoreProvider.start(BoltNeo4jDatastoreProvider.java:64)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.startService(AbstractServiceRegistryImpl.java:332)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:240)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
at org.hibernate.ogm.dialect.impl.GridDialectInitiator.initiateService(GridDialectInitiator.java:51)
at org.hibernate.ogm.dialect.impl.GridDialectInitiator.initiateService(GridDialectInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:254)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:228)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator$OgmDialectFactory.<init>(OgmDialectFactoryInitiator.java:44)
at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator.initiateService(OgmDialectFactoryInitiator.java:31)
at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator.initiateService(OgmDialectFactoryInitiator.java:25)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:254)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:228)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:50)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:254)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:228)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
at org.hibernate.ogm.service.impl.OgmJdbcServicesInitiator$OgmJdbcServicesImpl.configure(OgmJdbcServicesInitiator.java:51)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:848)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:875)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
... 5 more
Caused by: org.hibernate.HibernateException: OGM001419: Connection failed on bolt://localhost:7687/neo4j, error code N/A SSL Connection terminated while receiving data. This can happen due to network instabilities, or due to restarts of the database.
at org.hibernate.ogm.datastore.neo4j.remote.bolt.impl.BoltNeo4jClient.validateConnection(BoltNeo4jClient.java:51)
at org.hibernate.ogm.datastore.neo4j.remote.bolt.impl.BoltNeo4jDatastoreProvider.validateConnection(BoltNeo4jDatastoreProvider.java:71)
at org.hibernate.ogm.datastore.neo4j.remote.bolt.impl.BoltNeo4jDatastoreProvider.start(BoltNeo4jDatastoreProvider.java:58)
... 37 more
Process finished with exit code 1
如果尝试使用相同的身份验证连接到服务器并使用 neo4j 桌面 url 数据,我会成功。
我真的不明白为什么这不起作用。
完整代码在 github 上的 link 中:https://github.com/AndreLuis117/ondm-frameworks-experiment/tree/master/hibernateOGM/neo4j_hibernateOGM
以防有人想看依赖。
我用来创建 docker 容器的脚本是:
docker run `
--name testneo4j `
-p7474:7474 -p7687:7687 `
-d `
-v $HOME/neo4j/data:/data `
-v $HOME/neo4j/logs:/logs `
-v $HOME/neo4j/import:/var/lib/neo4j/import `
-v $HOME/neo4j/plugins:/plugins `
--env NEO4J_AUTH=neo4j/test `
--env NEO4J_dbms_connector_https_advertised__address="localhost:7473" `
--env NEO4J_dbms_connector_http_advertised__address="localhost:7474" `
--env NEO4J_dbms_connector_bolt_advertised__address="localhost:7687" `
neo4j:latest
有人可以帮助我吗?这里有没有人设法使用远程服务器用 neo4j 实现 hibernate ogm?有人有这个实现的例子吗?
在撰写本文时,Hibernate OGM 仅与 Neo4j 3.x 兼容。
Neo4j 3.5 是长期支持版本,因此您应该能够启动 3.5.x Docker 容器并使用您的应用程序连接到它。
我正在尝试使用 hibernate ogm 连接到我正在 运行 使用本地计算机上的 docker 的 neo4j 服务器。
当我尝试连接时收到消息:
Exception in thread "main" javax.persistence.PersistenceException: Unable to build entity manager factory
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:66)
at org.hibernate.ogm.jpa.HibernateOgmPersistence.createEntityManagerFactory(HibernateOgmPersistence.java:59)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
at base.service.NoRelationshipTestsService.<init>(NoRelationshipTestsService.java:14)
at base.Main.main(Main.java:13)
Caused by: org.hibernate.service.spi.ServiceException: OGM000071: Unable to start datastore provider
at org.hibernate.ogm.datastore.neo4j.remote.bolt.impl.BoltNeo4jDatastoreProvider.start(BoltNeo4jDatastoreProvider.java:64)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.startService(AbstractServiceRegistryImpl.java:332)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:240)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
at org.hibernate.ogm.dialect.impl.GridDialectInitiator.initiateService(GridDialectInitiator.java:51)
at org.hibernate.ogm.dialect.impl.GridDialectInitiator.initiateService(GridDialectInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:254)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:228)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator$OgmDialectFactory.<init>(OgmDialectFactoryInitiator.java:44)
at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator.initiateService(OgmDialectFactoryInitiator.java:31)
at org.hibernate.ogm.dialect.impl.OgmDialectFactoryInitiator.initiateService(OgmDialectFactoryInitiator.java:25)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:254)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:228)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:50)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:254)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:228)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
at org.hibernate.ogm.service.impl.OgmJdbcServicesInitiator$OgmJdbcServicesImpl.configure(OgmJdbcServicesInitiator.java:51)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:207)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:848)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:875)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
... 5 more
Caused by: org.hibernate.HibernateException: OGM001419: Connection failed on bolt://localhost:7687/neo4j, error code N/A SSL Connection terminated while receiving data. This can happen due to network instabilities, or due to restarts of the database.
at org.hibernate.ogm.datastore.neo4j.remote.bolt.impl.BoltNeo4jClient.validateConnection(BoltNeo4jClient.java:51)
at org.hibernate.ogm.datastore.neo4j.remote.bolt.impl.BoltNeo4jDatastoreProvider.validateConnection(BoltNeo4jDatastoreProvider.java:71)
at org.hibernate.ogm.datastore.neo4j.remote.bolt.impl.BoltNeo4jDatastoreProvider.start(BoltNeo4jDatastoreProvider.java:58)
... 37 more
Process finished with exit code 1
如果尝试使用相同的身份验证连接到服务器并使用 neo4j 桌面 url 数据,我会成功。
我真的不明白为什么这不起作用。
完整代码在 github 上的 link 中:https://github.com/AndreLuis117/ondm-frameworks-experiment/tree/master/hibernateOGM/neo4j_hibernateOGM
以防有人想看依赖。
我用来创建 docker 容器的脚本是:
docker run `
--name testneo4j `
-p7474:7474 -p7687:7687 `
-d `
-v $HOME/neo4j/data:/data `
-v $HOME/neo4j/logs:/logs `
-v $HOME/neo4j/import:/var/lib/neo4j/import `
-v $HOME/neo4j/plugins:/plugins `
--env NEO4J_AUTH=neo4j/test `
--env NEO4J_dbms_connector_https_advertised__address="localhost:7473" `
--env NEO4J_dbms_connector_http_advertised__address="localhost:7474" `
--env NEO4J_dbms_connector_bolt_advertised__address="localhost:7687" `
neo4j:latest
有人可以帮助我吗?这里有没有人设法使用远程服务器用 neo4j 实现 hibernate ogm?有人有这个实现的例子吗?
在撰写本文时,Hibernate OGM 仅与 Neo4j 3.x 兼容。
Neo4j 3.5 是长期支持版本,因此您应该能够启动 3.5.x Docker 容器并使用您的应用程序连接到它。