Spring,Spring Neo4j和Neo4j的依赖版本问题

时间:2014-06-21 12:34:56

标签: spring neo4j spring-data-neo4j

我正在尝试设置一个使用Spring-Neo4j和Neo4j的Java项目,但无法解决依赖性问题。我正在使用maven进行依赖管理,并尝试了Spring,Spring Neo4j和Neo4j的几个版本组合。

spring: 3.2.6.RELEASE

spring-data-neo4j: 3.0.0.RELEASE

neo4j: 2.0.1

application-context.xml文件

<neo4j:config storeDirectory="data/graph.db" /> 

错误:

Caused by: org.neo4j.kernel.impl.storemigration.UpgradeNotAllowedByConfigurationException: Failed to start Neo4j with an older data store version. To enable automatic upgrade, please set configuration parameter "allow_store_upgrade=true"
at org.neo4j.kernel.impl.storemigration.ConfigMapUpgradeConfiguration.checkConfigurationAllowsAutomaticUpgrade(ConfigMapUpgradeConfiguration.java:39)
at org.neo4j.kernel.impl.storemigration.StoreUpgrader.attemptUpgrade(StoreUpgrader.java:71)
at org.neo4j.kernel.impl.nioneo.store.StoreFactory.tryToUpgradeStores(StoreFactory.java:144)
at org.neo4j.kernel.impl.nioneo.store.StoreFactory.newNeoStore(StoreFactory.java:119)
at org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.start(NeoStoreXaDataSource.java:323)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:503)
... 64 more

我在allow_store_upgrade=true文件中启用了neo4j.properties

2 个答案:

答案 0 :(得分:0)

你的嵌入式neo4j很可能没有拿起neo4j文件(this文档说你需要手动设置它。)

像这样初始化你的neo4j

<bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase"
        destroy-method="shutdown">
    <constructor-arg index="0" value="target/config-test"/>
<!-- optionally pass in neo4j-config parameters to the graph database
    <constructor-arg index="1">
        <map>
            <entry key="allow_store_upgrade" value="true"/>
        </map>
    </constructor-arg>
-->
</bean>

<neo4j:config graphDatabaseService="graphDatabaseService"/>

来源: http://docs.spring.io/spring-data/data-neo4j/docs/3.0.1.RELEASE/reference/html/setup.html#d0e3597

答案 1 :(得分:0)

我正在尝试使用spring-data-neo4j 3.1.1.RELEASE和neo4j 2.1.2,我认为这是不完整的。实际上,至少对于这些版本,地图不是选项。此外,在Dependencies类型的构造函数中有第三个必需参数。 问题是我不知道第三个参数是什么,而且不推荐使用EmbeddedGraphDatabase和Dependecies。您知道在嵌入模式下启动webapp(使用这些版本)的好方法是什么?