Neo4j 2.0,java - 无法使用较旧的数据存储版本启动Neo4j

时间:2014-01-28 22:18:03

标签: java maven neo4j

我曾经在我的java maven项目中使用neo4j-community-1.9.4。我切换到2.0版并在2.0中完成了新的db。当我运行相同的java代码时,我收到错误:

Exception in thread "main" 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:64)
at org.neo4j.kernel.impl.nioneo.store.StoreFactory.tryToUpgradeStores(StoreFactory.java:104)
at org.neo4j.kernel.impl.nioneo.store.StoreFactory.newNeoStore(StoreFactory.java:86)
at org.neo4j.kernel.impl.nioneo.xa.NeoStoreXaDataSource.<init>(NeoStoreXaDataSource.java:232)
at org.neo4j.kernel.InternalAbstractGraphDatabase.create(InternalAbstractGraphDatabase.java:423)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:226)
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:79)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:70)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:205)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:56)
at tools.Import.main(Import.java:32)

有什么想法吗?谢谢。

3 个答案:

答案 0 :(得分:9)

Neo4j 2.0需要显式商店升级,因为旧版本将无法再在升级后的商店上运行。例外提到了这一点:

Failed to start Neo4j with an older data store version. To enable automatic upgrade, please set configuration parameter "allow_store_upgrade=true"

只需将allow_store_upgrade=true添加到neo4j.properties文件中,然后重新启动数据库即可。然后它应该进行升级。你可以在这里阅读更多相关信息:

http://docs.neo4j.org/chunked/stable/deployment-upgrading.html#explicit-upgrade

答案 1 :(得分:1)

解决了,我从spring取代了依赖:

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
<version>2.3.3.RELEASE</version>
</dependency>

由此:

<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>2.0.0</version>
</dependency>

答案 2 :(得分:1)

对于Windows上的社区版,

  • 点击选项,数据库配置,编辑
  • 寻找allow_store_upgrade

enter image description here

enter image description here