弹性搜索的泰坦加载问题
Titan loading problems with elastic search
我正在使用以下代码加载 Titan:
TitanFactory.Builder config = TitanFactory.build();
config.set("storage.backend", "berkeleyje");
config.set("storage.directory", DIRECTORY);
//config.set("storage.conf-file", "file:////" + DIRECTORY + "/cassandra/cassandra.yaml");
config.set("index." + INDEX_NAME + ".backend", "elasticsearch");
config.set("index." + INDEX_NAME + ".DIRECTORY", DIRECTORY + File.separator + "es");
config.set("index." + INDEX_NAME + ".elasticsearch.local-mode", true);
config.set("index." + INDEX_NAME + ".elasticsearch.client-only", false);
graph = config.open();
加载依赖项 gradle:
compile group: 'com.thinkaurelius.titan', name: 'titan-all', version: '1.0.0'
我的项目目录是:
/home/ray/IdeaProjects/BAG - 图数据库的拜占庭容错架构/
我的泰坦在文件夹"TITAN"中的这个项目目录中
这就是我在 Directory 变量中设置的内容。
还在启动时总是崩溃:
22:56:01.420 [main] DEBUG c.t.t.d.b.BerkeleyJEStoreManager - Opened database system_properties
java.lang.Throwable: null
at com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager.openDatabase(BerkeleyJEStoreManager.java:172) [titan-berkeleyje-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager.openDatabase(BerkeleyJEStoreManager.java:34) [titan-berkeleyje-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.OrderedKeyValueStoreManagerAdapter.openDatabase(OrderedKeyValueStoreManagerAdapter.java:76) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.OrderedKeyValueStoreManagerAdapter.openDatabase(OrderedKeyValueStoreManagerAdapter.java:69) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.OrderedKeyValueStoreManagerAdapter.openDatabase(OrderedKeyValueStoreManagerAdapter.java:25) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.Backend.getStandaloneGlobalConfiguration(Backend.java:449) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1322) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139) [titan-core-1.0.0.jar:na]
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56) [main/:na]
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105) [main/:na]
at main.java.com.bag.server.TestServer.main(TestServer.java:428) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
22:56:01.423 [main] DEBUG c.t.t.d.k.k.OrderedKeyValueStoreAdapter - Used key length 0 for database system_properties
22:56:01.429 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader$LoaderConfiguration - Option loading enabled by default
22:56:01.431 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added preferred classloader to config option loader chain: sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.431 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added thread context classloader to config option loader chain: sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.431 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added caller classloader to config option loader chain: sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.442 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager with loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.442 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Located functioning classloader sun.misc.Launcher$AppClassLoader@63e31ee; using it for remaining classload attempts
22:56:01.447 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.cassandra.astyanax.AstyanaxStoreManager with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.447 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreManager with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.452 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.cassandra.thrift.CassandraThriftStoreManager with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.459 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.460 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Unable to load class com.thinkaurelius.titan.diskstorage.solr.SolrIndex with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
java.lang.ClassNotFoundException: com.thinkaurelius.titan.diskstorage.solr.SolrIndex
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_112]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_112]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_112]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_112]
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_112]
at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_112]
at com.thinkaurelius.titan.core.util.ReflectiveConfigOptionLoader.loadStandard(ReflectiveConfigOptionLoader.java:136) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace.getChild(ConfigNamespace.java:68) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.ConfigElement.parse(ConfigElement.java:180) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration.getAll(BasicConfiguration.java:80) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1327) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139) [titan-core-1.0.0.jar:na]
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56) [main/:na]
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105) [main/:na]
at main.java.com.bag.server.TestServer.main(TestServer.java:428) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
22:56:01.462 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLog with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.463 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLogManager with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.463 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.464 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.graphdb.database.idassigner.placement.SimpleBulkPlacementStrategy with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.465 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.graphdb.database.idassigner.VertexIDAssigner with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.465 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.465 [main] INFO c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded and initialized config classes: 11 OK out of 12 attempts in PT0.035S
22:56:01.466 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added preferred classloader to config option loader chain: sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.466 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added thread context classloader to config option loader chain: sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.466 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added caller classloader to config option loader chain: sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.493 [main] DEBUG org.reflections.Reflections - going to scan these urls:
file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/
22:56:01.497 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/TestServer.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.497 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/TestServer.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.497 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/ConflictHandler.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.498 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/ConflictHandler.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.502 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/database/Neo4jDatabaseAccess.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.503 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/database/Neo4jDatabaseAccess.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.506 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/database/OrientDBDatabaseAccess.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.506 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/database/OrientDBDatabaseAccess.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.508 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/client/TestClient.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.508 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/client/TestClient.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.516 [main] INFO org.reflections.Reflections - Reflections took 22 ms to scan 1 urls, producing 6 keys and 13 values
22:56:01.518 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Preloaded 0 config option(s) via Reflections (0 class(es) with errors)
22:56:01.518 [main] DEBUG c.t.t.d.c.BasicConfiguration - Ignored configuration entry for index.search.DIRECTORY since it does not map to an option
java.lang.IllegalArgumentException: Unknown configuration element in namespace [root.index]: DIRECTORY
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-18.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.ConfigElement.parse(ConfigElement.java:181) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration.getAll(BasicConfiguration.java:80) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1327) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139) [titan-core-1.0.0.jar:na]
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56) [main/:na]
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105) [main/:na]
at main.java.com.bag.server.TestServer.main(TestServer.java:428) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
22:56:01.557 [main] DEBUG c.t.t.d.c.BasicConfiguration - Ignored configuration entry for index.search.DIRECTORY since it does not map to an option
java.lang.IllegalArgumentException: Unknown configuration element in namespace [root.index]: DIRECTORY
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-18.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.ConfigElement.parse(ConfigElement.java:181) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration.getAll(BasicConfiguration.java:80) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1383) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139) [titan-core-1.0.0.jar:na]
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56) [main/:na]
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105) [main/:na]
at main.java.com.bag.server.TestServer.main(TestServer.java:428) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
22:56:01.563 [main] DEBUG c.t.t.d.b.BerkeleyJEStoreManager - Removed database system_properties
22:56:01.613 [main] INFO c.t.t.g.c.GraphDatabaseConfiguration - Generated unique-instance-id=c0a8000d21256-Laptop1
22:56:01.641 [main] INFO c.t.titan.diskstorage.Backend - Configuring index [search]
Exception in thread "main" java.lang.IllegalArgumentException: Could not instantiate implementation: com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex
at com.thinkaurelius.titan.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:55)
at com.thinkaurelius.titan.diskstorage.Backend.getImplementationClass(Backend.java:473)
at com.thinkaurelius.titan.diskstorage.Backend.getIndexes(Backend.java:460)
at com.thinkaurelius.titan.diskstorage.Backend.<init>(Backend.java:147)
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.getBackend(GraphDatabaseConfiguration.java:1805)
at com.thinkaurelius.titan.graphdb.database.StandardTitanGraph.<init>(StandardTitanGraph.java:123)
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94)
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84)
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139)
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56)
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105)
at main.java.com.bag.server.TestServer.main(TestServer.java:428)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.thinkaurelius.titan.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:44)
... 16 more
Caused by: java.lang.NoSuchFieldError: LUCENE_3_6
at org.elasticsearch.Version.<clinit>(Version.java:43)
at com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex.checkExpectedClientVersion(ElasticSearchIndex.java:1059)
at com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex.<init>(ElasticSearchIndex.java:186)
... 21 more
我的 gradle 文件:
testCompile group: 'junit', name: 'junit', version: '4.11'
compile files('libs/BFT-SMaRt.jar')
compile "org.neo4j:neo4j-enterprise:${neo4jVersion}"
compile group: 'commons-codec', name: 'commons-codec', version: '1.5'
compile group: 'io.netty', name: 'netty-all', version: '4.0.36.Final'
compile group: 'com.thinkaurelius.titan', name: 'titan-all', version: '1.0.0'
compile group: 'com.sparsity', name: 'sparkseejava', version: '5.2.0'
compile group: 'com.orientechnologies', name: 'orientdb-graphdb', version: '2.2.11'
compile group: 'org.jboss.spec.javax.ws.rs', name: 'jboss-jaxrs-api_2.0_spec', version: '1.0.0.Final'
compile group: 'com.esotericsoftware', name: 'kryo', version: '4.0.0'
compile 'com.intellij:annotations:+@jar'
compile group: 'org.apache.tinkerpop', name: 'gremlin-core', version: '3.0.0.M9-incubating'
您似乎遇到了类路径问题:
Caused by: java.lang.NoSuchFieldError: LUCENE_3_6 at org.elasticsearch.Version.(Version.java:43)
Titan-es 1.0.0 依赖于 Elasticsearch 1.5.1,而 Elasticsearch 1.5.1 又依赖于 Lucene 4.10.4,后者有一个已弃用的字段 org.apache.lucene.util.Version.LUCENE_3_6
。此字段在 Lucene 的更高版本中被删除。您需要检查您的类路径并确保您正在引入正确版本的 Lucene。
您应该更具体地说明您的 Titan 依赖项,以免引入意外的工件。不要使用 titan-all
,而是尝试这样的事情:
compile group: 'com.thinkaurelius.titan', name: 'titan-berkeleyje', version: '1.0.0'
compile group: 'com.thinkaurelius.titan', name: 'titan-es', version: '1.0.0'
您不需要明确包含 gremlin-core
,因为它是 titan-core
的依赖项,但是如果您添加它,它应该与 Titan 1.0 的 TinkerPop version 保持一致使用:
compile group: 'org.apache.tinkerpop', name: 'gremlin-core', version: '3.0.1-incubating'
已更新
您之前的失败尝试可能创建了存储在 DIRECTORY
下的无效图形实例。在尝试使用同一目录创建新图之前,您必须递归删除 DIRECTORY
。
Elasticsearch 索引后端不适用于 index.search.DIRECTORY
配置(注意大小写)。这是堆栈跟踪的相关部分:
Ignored configuration entry for index.search.DIRECTORY since it does not map to an option
java.lang.IllegalArgumentException: Unknown configuration element in namespace [root.index]: DIRECTORY
您可以在 Titan 文档的 Chapter 22 中阅读有关各种 Elasticsearch 配置选项的更多信息。
考虑使用 Lucene 而不是 Elasticsearch。它的配置看起来类似于 BerkeleyJE 存储,两者都非常适合单机 Titan。
TitanFactory.Builder config = TitanFactory.build();
config.set("storage.backend", "berkeleyje");
config.set("storage.directory", DIRECTORY + File.separator + "berkeleyje");
config.set("index." + INDEX_NAME + ".backend", "lucene");
config.set("index." + INDEX_NAME + ".directory", DIRECTORY + File.separator + "lucene");
graph = config.open();
同时更新 build.gradle
与 lucene 的依赖关系:
compile group: 'com.thinkaurelius.titan', name: 'titan-berkeleyje', version: '1.0.0'
compile group: 'com.thinkaurelius.titan', name: 'titan-lucene', version: '1.0.0'
我还建议首先尝试构建一个没有 Neo4j、OrientDB、Sparksee 和其他非 Titan 依赖项的 Titan 项目,以确保您有一个简单的项目,可以在没有任何依赖项冲突的情况下工作。
我正在使用以下代码加载 Titan:
TitanFactory.Builder config = TitanFactory.build();
config.set("storage.backend", "berkeleyje");
config.set("storage.directory", DIRECTORY);
//config.set("storage.conf-file", "file:////" + DIRECTORY + "/cassandra/cassandra.yaml");
config.set("index." + INDEX_NAME + ".backend", "elasticsearch");
config.set("index." + INDEX_NAME + ".DIRECTORY", DIRECTORY + File.separator + "es");
config.set("index." + INDEX_NAME + ".elasticsearch.local-mode", true);
config.set("index." + INDEX_NAME + ".elasticsearch.client-only", false);
graph = config.open();
加载依赖项 gradle:
compile group: 'com.thinkaurelius.titan', name: 'titan-all', version: '1.0.0'
我的项目目录是:
/home/ray/IdeaProjects/BAG - 图数据库的拜占庭容错架构/
我的泰坦在文件夹"TITAN"中的这个项目目录中 这就是我在 Directory 变量中设置的内容。
还在启动时总是崩溃:
22:56:01.420 [main] DEBUG c.t.t.d.b.BerkeleyJEStoreManager - Opened database system_properties
java.lang.Throwable: null
at com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager.openDatabase(BerkeleyJEStoreManager.java:172) [titan-berkeleyje-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager.openDatabase(BerkeleyJEStoreManager.java:34) [titan-berkeleyje-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.OrderedKeyValueStoreManagerAdapter.openDatabase(OrderedKeyValueStoreManagerAdapter.java:76) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.OrderedKeyValueStoreManagerAdapter.openDatabase(OrderedKeyValueStoreManagerAdapter.java:69) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.keycolumnvalue.keyvalue.OrderedKeyValueStoreManagerAdapter.openDatabase(OrderedKeyValueStoreManagerAdapter.java:25) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.Backend.getStandaloneGlobalConfiguration(Backend.java:449) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1322) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139) [titan-core-1.0.0.jar:na]
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56) [main/:na]
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105) [main/:na]
at main.java.com.bag.server.TestServer.main(TestServer.java:428) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
22:56:01.423 [main] DEBUG c.t.t.d.k.k.OrderedKeyValueStoreAdapter - Used key length 0 for database system_properties
22:56:01.429 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader$LoaderConfiguration - Option loading enabled by default
22:56:01.431 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added preferred classloader to config option loader chain: sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.431 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added thread context classloader to config option loader chain: sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.431 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added caller classloader to config option loader chain: sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.442 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.hbase.HBaseStoreManager with loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.442 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Located functioning classloader sun.misc.Launcher$AppClassLoader@63e31ee; using it for remaining classload attempts
22:56:01.447 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.cassandra.astyanax.AstyanaxStoreManager with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.447 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreManager with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.452 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.cassandra.thrift.CassandraThriftStoreManager with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.459 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.460 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Unable to load class com.thinkaurelius.titan.diskstorage.solr.SolrIndex with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
java.lang.ClassNotFoundException: com.thinkaurelius.titan.diskstorage.solr.SolrIndex
at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_112]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_112]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_112]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_112]
at java.lang.Class.forName0(Native Method) ~[na:1.8.0_112]
at java.lang.Class.forName(Class.java:348) ~[na:1.8.0_112]
at com.thinkaurelius.titan.core.util.ReflectiveConfigOptionLoader.loadStandard(ReflectiveConfigOptionLoader.java:136) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace.getChild(ConfigNamespace.java:68) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.ConfigElement.parse(ConfigElement.java:180) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration.getAll(BasicConfiguration.java:80) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1327) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139) [titan-core-1.0.0.jar:na]
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56) [main/:na]
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105) [main/:na]
at main.java.com.bag.server.TestServer.main(TestServer.java:428) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
22:56:01.462 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLog with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.463 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.log.kcvs.KCVSLogManager with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.463 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.464 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.graphdb.database.idassigner.placement.SimpleBulkPlacementStrategy with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.465 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.graphdb.database.idassigner.VertexIDAssigner with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.465 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded class com.thinkaurelius.titan.diskstorage.berkeleyje.BerkeleyJEStoreManager with selected loader sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.465 [main] INFO c.t.t.c.u.ReflectiveConfigOptionLoader - Loaded and initialized config classes: 11 OK out of 12 attempts in PT0.035S
22:56:01.466 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added preferred classloader to config option loader chain: sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.466 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added thread context classloader to config option loader chain: sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.466 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Added caller classloader to config option loader chain: sun.misc.Launcher$AppClassLoader@63e31ee
22:56:01.493 [main] DEBUG org.reflections.Reflections - going to scan these urls:
file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/
22:56:01.497 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/TestServer.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.497 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/TestServer.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.497 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/ConflictHandler.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.498 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/ConflictHandler.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.502 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/database/Neo4jDatabaseAccess.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.503 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/database/Neo4jDatabaseAccess.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.506 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/database/OrientDBDatabaseAccess.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.506 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/server/database/OrientDBDatabaseAccess.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.508 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/client/TestClient.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner TypeAnnotationsScanner
22:56:01.508 [main] DEBUG org.reflections.Reflections - could not scan file main/java/com/bag/client/TestClient.class in url file:/home/ray/IdeaProjects/BAG%20-%20Byzantine%20fault-tolerant%20Architecture%20for%20Graph%20database/build/classes/main/ with scanner SubTypesScanner
22:56:01.516 [main] INFO org.reflections.Reflections - Reflections took 22 ms to scan 1 urls, producing 6 keys and 13 values
22:56:01.518 [main] DEBUG c.t.t.c.u.ReflectiveConfigOptionLoader - Preloaded 0 config option(s) via Reflections (0 class(es) with errors)
22:56:01.518 [main] DEBUG c.t.t.d.c.BasicConfiguration - Ignored configuration entry for index.search.DIRECTORY since it does not map to an option
java.lang.IllegalArgumentException: Unknown configuration element in namespace [root.index]: DIRECTORY
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-18.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.ConfigElement.parse(ConfigElement.java:181) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration.getAll(BasicConfiguration.java:80) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1327) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139) [titan-core-1.0.0.jar:na]
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56) [main/:na]
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105) [main/:na]
at main.java.com.bag.server.TestServer.main(TestServer.java:428) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
22:56:01.557 [main] DEBUG c.t.t.d.c.BasicConfiguration - Ignored configuration entry for index.search.DIRECTORY since it does not map to an option
java.lang.IllegalArgumentException: Unknown configuration element in namespace [root.index]: DIRECTORY
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-18.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.ConfigElement.parse(ConfigElement.java:181) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration.getAll(BasicConfiguration.java:80) ~[titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1383) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84) [titan-core-1.0.0.jar:na]
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139) [titan-core-1.0.0.jar:na]
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56) [main/:na]
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105) [main/:na]
at main.java.com.bag.server.TestServer.main(TestServer.java:428) [main/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_112]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_112]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_112]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_112]
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147) [idea_rt.jar:na]
22:56:01.563 [main] DEBUG c.t.t.d.b.BerkeleyJEStoreManager - Removed database system_properties
22:56:01.613 [main] INFO c.t.t.g.c.GraphDatabaseConfiguration - Generated unique-instance-id=c0a8000d21256-Laptop1
22:56:01.641 [main] INFO c.t.titan.diskstorage.Backend - Configuring index [search]
Exception in thread "main" java.lang.IllegalArgumentException: Could not instantiate implementation: com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex
at com.thinkaurelius.titan.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:55)
at com.thinkaurelius.titan.diskstorage.Backend.getImplementationClass(Backend.java:473)
at com.thinkaurelius.titan.diskstorage.Backend.getIndexes(Backend.java:460)
at com.thinkaurelius.titan.diskstorage.Backend.<init>(Backend.java:147)
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.getBackend(GraphDatabaseConfiguration.java:1805)
at com.thinkaurelius.titan.graphdb.database.StandardTitanGraph.<init>(StandardTitanGraph.java:123)
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94)
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:84)
at com.thinkaurelius.titan.core.TitanFactory$Builder.open(TitanFactory.java:139)
at main.java.com.bag.server.database.TitanDatabaseAccess.start(TitanDatabaseAccess.java:56)
at main.java.com.bag.server.TestServer.<init>(TestServer.java:105)
at main.java.com.bag.server.TestServer.main(TestServer.java:428)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.thinkaurelius.titan.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:44)
... 16 more
Caused by: java.lang.NoSuchFieldError: LUCENE_3_6
at org.elasticsearch.Version.<clinit>(Version.java:43)
at com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex.checkExpectedClientVersion(ElasticSearchIndex.java:1059)
at com.thinkaurelius.titan.diskstorage.es.ElasticSearchIndex.<init>(ElasticSearchIndex.java:186)
... 21 more
我的 gradle 文件:
testCompile group: 'junit', name: 'junit', version: '4.11'
compile files('libs/BFT-SMaRt.jar')
compile "org.neo4j:neo4j-enterprise:${neo4jVersion}"
compile group: 'commons-codec', name: 'commons-codec', version: '1.5'
compile group: 'io.netty', name: 'netty-all', version: '4.0.36.Final'
compile group: 'com.thinkaurelius.titan', name: 'titan-all', version: '1.0.0'
compile group: 'com.sparsity', name: 'sparkseejava', version: '5.2.0'
compile group: 'com.orientechnologies', name: 'orientdb-graphdb', version: '2.2.11'
compile group: 'org.jboss.spec.javax.ws.rs', name: 'jboss-jaxrs-api_2.0_spec', version: '1.0.0.Final'
compile group: 'com.esotericsoftware', name: 'kryo', version: '4.0.0'
compile 'com.intellij:annotations:+@jar'
compile group: 'org.apache.tinkerpop', name: 'gremlin-core', version: '3.0.0.M9-incubating'
您似乎遇到了类路径问题:
Caused by: java.lang.NoSuchFieldError: LUCENE_3_6 at org.elasticsearch.Version.(Version.java:43)
Titan-es 1.0.0 依赖于 Elasticsearch 1.5.1,而 Elasticsearch 1.5.1 又依赖于 Lucene 4.10.4,后者有一个已弃用的字段 org.apache.lucene.util.Version.LUCENE_3_6
。此字段在 Lucene 的更高版本中被删除。您需要检查您的类路径并确保您正在引入正确版本的 Lucene。
您应该更具体地说明您的 Titan 依赖项,以免引入意外的工件。不要使用 titan-all
,而是尝试这样的事情:
compile group: 'com.thinkaurelius.titan', name: 'titan-berkeleyje', version: '1.0.0'
compile group: 'com.thinkaurelius.titan', name: 'titan-es', version: '1.0.0'
您不需要明确包含 gremlin-core
,因为它是 titan-core
的依赖项,但是如果您添加它,它应该与 Titan 1.0 的 TinkerPop version 保持一致使用:
compile group: 'org.apache.tinkerpop', name: 'gremlin-core', version: '3.0.1-incubating'
已更新
您之前的失败尝试可能创建了存储在 DIRECTORY
下的无效图形实例。在尝试使用同一目录创建新图之前,您必须递归删除 DIRECTORY
。
Elasticsearch 索引后端不适用于 index.search.DIRECTORY
配置(注意大小写)。这是堆栈跟踪的相关部分:
Ignored configuration entry for index.search.DIRECTORY since it does not map to an option java.lang.IllegalArgumentException: Unknown configuration element in namespace [root.index]: DIRECTORY
您可以在 Titan 文档的 Chapter 22 中阅读有关各种 Elasticsearch 配置选项的更多信息。
考虑使用 Lucene 而不是 Elasticsearch。它的配置看起来类似于 BerkeleyJE 存储,两者都非常适合单机 Titan。
TitanFactory.Builder config = TitanFactory.build();
config.set("storage.backend", "berkeleyje");
config.set("storage.directory", DIRECTORY + File.separator + "berkeleyje");
config.set("index." + INDEX_NAME + ".backend", "lucene");
config.set("index." + INDEX_NAME + ".directory", DIRECTORY + File.separator + "lucene");
graph = config.open();
同时更新 build.gradle
与 lucene 的依赖关系:
compile group: 'com.thinkaurelius.titan', name: 'titan-berkeleyje', version: '1.0.0'
compile group: 'com.thinkaurelius.titan', name: 'titan-lucene', version: '1.0.0'
我还建议首先尝试构建一个没有 Neo4j、OrientDB、Sparksee 和其他非 Titan 依赖项的 Titan 项目,以确保您有一个简单的项目,可以在没有任何依赖项冲突的情况下工作。