Spring Data Neo4j:在嵌入式服务器上使用 [英] Spring Data Neo4j: Using the server with an embedded

查看:66
本文介绍了Spring Data Neo4j:在嵌入式服务器上使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试配置我的应用程序上下文,以便能够将Neo4j服务器与我的应用程序中的嵌入式图形一起使用而没有取得太大的成功.我同时使用Spring Data(Mongo和Neo4j存储库方法).这是我的应用程序上下文,没有运行:

I'm trying to configure my application context in order to be able to use the Neo4j server with an embedded graph in my app without much success. I'm using Spring Data at the same time (both Mongo and Neo4j repositories approach). This is my application-context, which isn't running:

<context:component-scan base-package="org.domain.team.project.*"/>

<mongo:repositories base-package="org.domain.team.project.data.repositories.mongodb"/>

    <!-- Neo4j -->
    <!--  <neo4j:config storeDirectory="/data/production/graph.db"/> -->
    <neo4j:repositories base-package="org.domain.team.project.data.repositories.neo4j"/>

    <neo4j:config graphDatabaseService="graphDatabaseService" />
    <bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase"
    destroy-method="shutdown">
        <constructor-arg index="0" value="/data/production/graph.db" />
        <constructor-arg index="1">
            <map><entry key="enable_remote_shell" value="true"/></map>
        </constructor-arg>
    </bean>
    <bean id="serverWrapper" class="org.neo4j.server.WrappingNeoServerBootstrapper" 
        init-method="start" destroy-method="stop">
            <constructor-arg ref="graphDatabaseService"/>
    </bean>

如果我不使用这种方法,只指定商店目录(注释行),则一切运行正常.我怀疑这是SDN和neo4j-server问题之间的版本.这是我的POM:

If I don't use this approach and specify simply the store directory (commented line) everything runs fine. I suspect it's a version between SDN and neo4j-server issue. This is my POM:

  <properties>
    <spring.data.mongo.version>1.1.0.RELEASE</spring.data.mongo.version>
    <spring.data.neo4j.version>2.1.0.RELEASE</spring.data.neo4j.version>
  </properties>

  <dependencies>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-mongodb</artifactId>
        <version>${spring.data.mongo.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-neo4j</artifactId>
        <version>${spring.data.neo4j.version}</version>
    </dependency>
    <dependency>
        <groupId>org.neo4j.app</groupId>
        <artifactId>neo4j-server</artifactId>
        <version>1.8.2</version>
    </dependency>
    <dependency>
        <groupId>org.neo4j.app</groupId>
        <artifactId>neo4j-server</artifactId>
        <classifier>static-web</classifier>
        <version>1.8.2</version>
    </dependency>
  </dependencies>

其父级具有Spring(core,context,test)3.2.0 Release作为依赖项.

Its parent has as a dependency Spring(core,context,test) 3.2.0 Release.

显示的具体错误是:

Caused by: java.lang.NoSuchFieldError: query_cache_size
    at org.neo4j.cypher.ExecutionEngine.org$neo4j$cypher$ExecutionEngine$$getQueryCacheSize(ExecutionEngine.scala:95)
    at org.neo4j.cypher.ExecutionEngine$$anon$1.<init>(ExecutionEngine.scala:91)
    at org.neo4j.cypher.ExecutionEngine.<init>(ExecutionEngine.scala:91)
    at org.neo4j.cypher.javacompat.ExecutionEngine.<init>(ExecutionEngine.java:54)
    at org.neo4j.cypher.javacompat.ExecutionEngine.<init>(ExecutionEngine.java:44)
    at org.springframework.data.neo4j.support.query.CypherQueryEngine.<init>(CypherQueryEngine.java:42)
    at org.springframework.data.neo4j.support.DelegatingGraphDatabase.createCypherQueryEngine(DelegatingGraphDatabase.java:217)
    at org.springframework.data.neo4j.support.DelegatingGraphDatabase.queryEngineFor(DelegatingGraphDatabase.java:190)
    at org.springframework.data.neo4j.support.MappingInfrastructureFactoryBean.afterPropertiesSet(MappingInfrastructureFactoryBean.java:146)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1483)
    ... 47 more

就我而言,

应该没有问题,因为默认值是100.SDN文档不会说太多了.有什么建议吗?

which as far as I am concerned, should be no problem as the default value is 100. The SDN doc does not talk too much about it. Any suggestions?

谢谢大家.

推荐答案

类似版本兼容性问题.对我来说,下面的组合很好用

Looks like version compatibility issue. For me below combination is working fine

spring-data-neo4j : 2.1.0.RC4
spring-data-mongodb : 1.1.0.RELEASE 
neo4j-server : 1.8
static-web : 1.8

我正在使用-

Spring framework version : 3.1.2.RELEASE
Neo4j version : 1.8
mongodb version : 2.2.2
mongo-java-driver : 2.9.1
slf4j : 1.7.2

这篇关于Spring Data Neo4j:在嵌入式服务器上使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆