1

我在同一台机器(Windows 7)上有neo4j 2.2.5社区版和java代码,我尝试使用以下代码连接到neo4j(没有HA)

Configuration config = new BaseConfiguration();
config.setProperty(Neo4jGraph.CONFIG_DIRECTORY, "C:\\Users\\mike\\Documents\\Neo4j");
 config.setProperty("gremlin.neo4j.conf.cache_type", "none");
 Graph toyGraph = Neo4jGraph.open(config);

但我收到以下异常

            Exception in thread "main" java.lang.RuntimeException: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, C:\Users\mike\Documents\Neo4j
                at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:334)
                at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:59)
                at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(GraphDatabaseFactory.java:108)
                at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:95)
                at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:176)
                at org.neo4j.tinkerpop.api.impl.Neo4jFactoryImpl.newGraphDatabase(Neo4jFactoryImpl.java:44)
                at org.neo4j.tinkerpop.api.Neo4jFactory$Builder.open(Neo4jFactory.java:32)
                at org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph.<init>(Neo4jGraph.java:130)
                at org.apache.tinkerpop.gremlin.neo4j.structure.Neo4jGraph.open(Neo4jGraph.java:144)
                at ca.concordia.orchestrator.test.TestNeo4j.main(TestNeo4j.java:33)
            Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.extension.KernelExtensions@7c0edd8f' failed to initialize. Please see attached cause exception.
                at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:489)
                at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:72)
                at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:106)
                at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:330)
                ... 9 more
            Caused by: java.lang.NoClassDefFoundError: org/apache/lucene/document/Fieldable
                at org.neo4j.kernel.api.impl.index.NodeRangeDocumentLabelScanStorageStrategy.<init>(NodeRangeDocumentLabelScanStorageStrategy.java:71)
                at org.neo4j.kernel.api.impl.index.LuceneLabelScanStoreExtension.newKernelExtension(LuceneLabelScanStoreExtension.java:73)
                at org.neo4j.kernel.api.impl.index.LuceneLabelScanStoreExtension.newKernelExtension(LuceneLabelScanStoreExtension.java:39)
                at org.neo4j.kernel.extension.KernelExtensions.init(KernelExtensions.java:66)
                at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:483)
                ... 12 more
            Caused by: java.lang.ClassNotFoundException: org.apache.lucene.document.Fieldable
                at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
                at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
                at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
                ... 17 more

我在 pom.xml 中有以下依赖项

            <dependency>
                <groupId>org.apache.tinkerpop</groupId>
                <artifactId>gremlin-core</artifactId>
                <version>3.0.1-incubating</version>
            </dependency>
            <dependency>
                <groupId>org.apache.tinkerpop</groupId>
                <artifactId>tinkergraph-gremlin</artifactId>
                <version>3.0.1-incubating</version>
            </dependency>


            <!-- Neo4j -->
            <dependency>
                <groupId>org.apache.tinkerpop</groupId>
                <artifactId>neo4j-gremlin</artifactId>
                <version>3.0.1-incubating</version>
            </dependency>
            <!-- neo4j-tinkerpop-api-impl is NOT Apache 2 licensed - more information
                below -->
            <dependency>
                <groupId>org.neo4j</groupId>
                <artifactId>neo4j-tinkerpop-api-impl</artifactId>
                <version>0.1-2.2</version>
            </dependency>   

知道可能是什么问题吗?Thinkerpop3 是否适用于 neo4j 2.2.5?

4

1 回答 1

2

看起来您的设置中的依赖版本存在问题。

如果您查看neo4j-tinkerpop-api-impl - 您可以看到当前在 master 中发布了 Neo4j 2.2.5。但是 maven Central 有 2.2 版本。

确保您在任何地方都使用正确版本的 Neo4j 依赖项。

在 Maven依赖树中可能会有所帮助。

于 2015-10-04T22:31:15.080 回答