使用Tinkerpop3连接到neo4j 2.2.5

时间:2015-10-03 11:17:38

标签: neo4j gremlin tinkerpop tinkerpop3

我在同一台机器上安装了neo4j 2.2.5社区版和java代码(Windows 7),我尝试使用以下代码连接到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?

1 个答案:

答案 0 :(得分:2)

您的设置中似乎存在依赖项版本问题。

如果你看一下neo4j-tinkerpop-api-impl - 你可以看到主人有Neo4j 2.2.5的版本。但是maven central有2.2版本。

确保您在所有地方使用正确版本的Neo4j依赖项。

在maven dependency tree中可以提供帮助。