连接到现有的graphdb失败了

时间:2016-09-07 08:39:56

标签: java neo4j

在尝试连接到现有或已创建的neo4j数据库实例时,我收到以下异常。我想,这个实例是在Graph DB查看器中使用的,所以试图关闭它并尝试重新启动整个机器,但没有任何作用。

API:

    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j</artifactId>
        <version>3.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-kernel</artifactId>
        <version>3.0.4</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.neo4j</groupId>
        <artifactId>neo4j-graphdb-api</artifactId>
        <version>3.0.4</version>
        <type>jar</type>
    </dependency>

代码:

    dbFactory = new GraphDatabaseFactory();
    File dbpath = new File("D:/neo4j/Neo4j1");
    db = dbFactory.newEmbeddedDatabaseBuilder(dbpath)
            .newGraphDatabase();
    registerShutdownHook(db);

修订例外:

Exception in thread "main" java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.CommunityFacadeFactory, D:\neo4j\Neo4j1
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:144)
at org.neo4j.kernel.impl.factory.CommunityFacadeFactory.newFacade(CommunityFacadeFactory.java:40)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:108)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(GraphDatabaseFactory.java:100)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.lambda$createDatabaseCreator$194(GraphDatabaseFactory.java:89)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$$Lambda$1/1851691492.newDatabase(Unknown Source)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:183)
at com.mycompany.neo4jnative.NewClass.<init>(NewClass.java:55)
at com.mycompany.neo4jnative.NewClass.main(NewClass.java:35)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.recovery.Recovery@101b3a78' failed to initialize. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:416)
at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:62)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:98)
at org.neo4j.kernel.NeoStoreDataSource.start(NeoStoreDataSource.java:508)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:434)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107)
at org.neo4j.kernel.impl.transaction.state.DataSourceManager.start(DataSourceManager.java:99)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.start(LifeSupport.java:434)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:107)
at org.neo4j.kernel.impl.factory.GraphDatabaseFacadeFactory.newFacade(GraphDatabaseFacadeFactory.java:140)
... 8 more
Caused by: java.lang.IllegalArgumentException: Unrecognized log entry version -9. At position LogPosition{logVersion=0, byteOffset=2450817} and entry version null
at org.neo4j.kernel.impl.transaction.log.entry.LogEntryVersion.byVersion(LogEntryVersion.java:147)
at org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader.readLogEntry(VersionAwareLogEntryReader.java:83)
at org.neo4j.kernel.impl.transaction.log.LogEntryCursor.next(LogEntryCursor.java:50)
at org.neo4j.kernel.recovery.LatestCheckPointFinder.find(LatestCheckPointFinder.java:77)
at org.neo4j.kernel.recovery.PositionToRecoverFrom.apply(PositionToRecoverFrom.java:53)
at org.neo4j.kernel.recovery.DefaultRecoverySPI.getPositionToRecoverFrom(DefaultRecoverySPI.java:112)
at org.neo4j.kernel.recovery.Recovery.init(Recovery.java:72)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:406)
... 17 more

更新

重建场景的步骤:

  1. 从java代码创建图形数据库(使用上面的代码)。
  2. 执行你想要的操作,如添加,删除节点,创建关系
  3. 停止java实例并在Neo4j社区查看器工具中打开数据库
  4. 按照密码设置步骤进行操作。
  5. 查询节点
  6. 停止Neo4j社区查看器工具
  7. 现在尝试从java代码中查找相同的数据库将最终出现上述异常。

0 个答案:

没有答案