我正在尝试使用hibernate ogm连接到neo4j服务器,我正在本地机器上使用docker运行该服务器。
当我尝试连接时,我得到一个信息:
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桌面我成功了。
我真的不明白为什么这样不行。
完整代码位于github的以下链接中: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
有人能帮我吗?这里有人用远程服务器实现了hibernate ogm和neo4j吗?有人举过这个例子吗?
1条答案
按热度按时间bfhwhh0e1#
在编写本文时,hibernate ogm只与neo4j 3.x兼容。
neo4j3.5是一个长期支持的版本,所以您应该能够启动一个3.5.xdocker容器,并用您的应用程序连接到它。