Dependency issue with titan 1.0.0

142 views
Skip to first unread message

史晔翎

unread,
Jun 15, 2016, 2:06:55 AM6/15/16
to Aurelius
Dear experts,
I met some dependency issue with titan+cassandra setup.

I started a gremlin-server+titan+cassandra+elasticsearch using the titan.sh from 1.0.0 dist zip folder.

and in my java application I'm trying to create a TitanGraph connecting to the cassandra instance running in the same host.
the titan configuration is like below:
-------------------------------------------------------------------------------------------------------------------------
storage.backend=cassandrathrift
storage.hostname=127.0.0.1
#storage.hostname=192.168.0.61
cache.db-cache=true
cache.db-cache-clean-wait=20
cache.db-cache-time=180000
cache.db-cache-size=0.25

index.search.backend=elasticsearch
index.search.hostname=127.0.0.1
index.search.elasticsearch.client-only=true
------------------------------------------------------------------------------------------------------------------------
and my pom file is including titan-all:1.0.0

--------------------------------------------------------------------------------------------------------------------------
<dependency>
  <groupId>com.thinkaurelius.titan</groupId>
  <artifactId>titan-all</artifactId>
  <version>1.0.0</version>
</dependency>
                <dependency>
            <groupId>com.thinkaurelius.titan</groupId>
            <artifactId>titan-solr</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
   <groupId>org.apache.lucene</groupId>
   <artifactId>lucene-expressions</artifactId>
   <version>4.10.4</version>
</dependency>
<dependency>
   <groupId>org.apache.lucene</groupId>
   <artifactId>lucene-codecs</artifactId>
   <version>4.10.4</version>
</dependency>
----------------------------------------------------------------------------------------------------------------------------

The problem I'm having now is that even the configuration file specifies elasticsearch, the server is still trying to load the solr related classes, and while doing elasticsearch indexing, the server again run into error with NoClassDefFoundError for org.apache.lucene.codecs.CompoundFormat. See the stack trace below.

Is there other dependencies that need to add so that I could connect properly?


10:15:20.757 [main] DEBUG com.thinkaurelius.titan.core.util.ReflectiveConfigOptionLoader - Unable to load class com.thinkaurelius.titan.diskstorage.solr.SolrIndex with selected loader sun.misc.Launcher$AppClassLoader@c387f44
java.lang.NoClassDefFoundError: org/apache/solr/client/solrj/impl/HttpSolrClient$RemoteSolrException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.thinkaurelius.titan.core.util.ReflectiveConfigOptionLoader.loadStandard(ReflectiveConfigOptionLoader.java:136)
at com.thinkaurelius.titan.diskstorage.configuration.ConfigNamespace.getChild(ConfigNamespace.java:68)
at com.thinkaurelius.titan.diskstorage.configuration.ConfigElement.parse(ConfigElement.java:180)
at com.thinkaurelius.titan.diskstorage.configuration.BasicConfiguration.getAll(BasicConfiguration.java:80)
at com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration.<init>(GraphDatabaseConfiguration.java:1327)
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:94)
at com.thinkaurelius.titan.core.TitanFactory.open(TitanFactory.java:74)
at com.zqykj.TitanDataReader.main(TitanDataReader.java:28)
Caused by: java.lang.ClassNotFoundException: org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException
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)
... 10 common frames omitted

and after connecting the titan instance will throw other exceptions like below:
10:15:32.085 [elasticsearch[Batwing][clusterService#updateTask][T#1]] WARN org.elasticsearch.indices.cluster - [Batwing] [[titan][1]] marking and sending shard failed due to [failed to create index]
org.elasticsearch.indices.IndexCreationException: [titan] failed to create index
....
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.codecs.CompoundFormat
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)
... 29 common frames omitted

Jason Plurad

unread,
Jun 15, 2016, 8:46:12 AM6/15/16
to Aurelius
Don't include titan-all and the others. Keep your dependencies as tight as possible. Try this instead.

<dependencies>
 
<dependency>
   
<groupId>com.thinkaurelius.titan</groupId>
   
<artifactId>titan-cassandra</artifactId>

   
<version>1.0.0</version>
 
</dependency>
 
<dependency>
   
<groupId>com.thinkaurelius.titan</groupId>

   
<artifactId>titan-es</artifactId>
   
<version>1.0.0</version>
 
</dependency>
</dependencies>

-- Jason

史晔翎

unread,
Jun 16, 2016, 11:18:14 PM6/16/16
to Aurelius
Thanks Jason,
After several tries, I noticed a warning in the log that saying my app is using elasticsearch version 1.5.2 which is not the version that titan 1.0.0 is built with, i.e. v1.5.1.
POM shows that it was introduced by titan-es 1.0.0.
Exclude the elasticsearch artifact and manually include 1.5.1 fixed the indexing creation exception. Though, its weird that the disted 1.0.0 version was built with elasticsearch 1.5.1 but the pom is including 1.5.2.

The solr related exception is still there but that doesn't seem to break anything so I just ignored it.


BR,
Yeling
Reply all
Reply to author
Forward
0 new messages