Neo4j,Blueprint和UpgradeNotAllowedByConfigurationException

时间:2015-02-21 00:02:47

标签: neo4j emf tinkerpop-blueprint

我正在Neo4j水中蘸我的脚趾,我遇到了以下错误:

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)
    ... 37 more

然而,我修改了neo4j.properties以包括:

  

启用此选项可以从旧版本升级商店

     

allow_store_upgrade =真

我正在使用Blueprints和Blueprints-emf。这是我的代码:

@ApplicationScoped
public class EmfPersistance {

    public void testCall() throws IOException{      

        EPackage.Registry.INSTANCE.put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);
        EPackage.Registry.INSTANCE.put(DomainPackage.eNS_URI, DomainPackage.eINSTANCE);        


        Neo4j2Graph graph = new Neo4j2Graph("/home/anton/Documents/software/neo4j/neo4j-community-2.1.7/data/graph.db");

        ResourceSet resourceSet = new ResourceSetImpl();
        resourceSet
            .getResourceFactoryRegistry()
            .getExtensionToFactoryMap()
            .put("*", new BlueprintsResourceFactory(graph));

        resourceSet
            .getURIConverter()
            .getURIHandlers()
            .add(0, new GraphHandler());


        Application app = DomainFactory.eINSTANCE.createApplication();
        app.setIdentifier("hello");
        User user = DomainFactory.eINSTANCE.createUser();
        user.setActualName("user");
        user.setUsername("user");
        user.setEmailAddress("email@gmail.com");



        Resource resource = resourceSet.createResource(URI.createURI("graph:/my/graph/users"));
        resource.getContents().add(user);
        resource.save(null);

        graph.shutdown();
    }

}

1 个答案:

答案 0 :(得分:3)

我遇到了同样的问题。我添加了以下依赖项和blueprints依赖项,我能够让我的测试运行。

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