neo4j-ogm 连接出错
发布于 8 年前 作者 wkq278276130 5567 次浏览 来自 问答

JDK 1.8 neo4j-ogm 2.0.3 Spring-data-neo4j 4.1.2

用eclipse连本地的neo4j数据库操作没有问题。 但是在本地连服务器上的neo4j数据库报错。
日志如下: 异常: org.neo4j.ogm.exception.ConnectionException: Error connecting to remote graph over HTTP at org.neo4j.ogm.drivers.http.request.HttpRequest.execute(HttpRequest.java:261) ~[neo4j-ogm-http-driver-2.0.3.jar:na] at org.neo4j.ogm.drivers.http.request.HttpRequest.executeRequest(HttpRequest.java:204) ~[neo4j-ogm-http-driver-2.0.3.jar:na] at org.neo4j.ogm.drivers.http.request.HttpRequest.execute(HttpRequest.java:89) ~[neo4j-ogm-http-driver-2.0.3.jar:na] at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.executeAndMap(ExecuteQueriesDelegate.java:110) ~[neo4j-ogm-core-2.0.3.jar:na] at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.query(ExecuteQueriesDelegate.java:82) ~[neo4j-ogm-core-2.0.3.jar:na] at org.neo4j.ogm.session.delegates.ExecuteQueriesDelegate.queryForObject(ExecuteQueriesDelegate.java:56) ~[neo4j-ogm-core-2.0.3.jar:na] at org.neo4j.ogm.session.Neo4jSession.queryForObject(Neo4jSession.java:308) ~[neo4j-ogm-core-2.0.3.jar:na] at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:78) ~[spring-data-neo4j-4.1.2.RELEASE.jar:na] at org.springframework.data.neo4j.repository.query.GraphRepositoryQuery.execute(GraphRepositoryQuery.java:52) ~[spring-data-neo4j-4.1.2.RELEASE.jar:na] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482) ~[spring-data-commons-1.12.2.RELEASE.jar:na] at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) ~[spring-data-commons-1.12.2.RELEASE.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) ~[spring-data-commons-1.12.2.RELEASE.jar:na] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) ~[spring-aop-4.2.4.RELEASE.jar:4.2.4.RELEASE] at com.sun.proxy.$Proxy89.findLabelByName(Unknown Source) ~[na:na]

3 回复

没有开启远程访问端口吧, neo4j.conf中

\# dbms.connector.http.address=0.0.0.0:#{default.http.port}

改成

dbms.connector.http.address=0.0.0.0:7474

@zhaobingcn 开了,可以通过浏览器访问,但是程序运行的时候报错。

找见问题了,代码里面写的有一点问题,在特殊情况下会报错。

回到顶部