0

I am trying to connect to JanusGraph using the following code:

Graph graph = GraphFactory.open(new PropertiesConfiguration("janusgraph.propertes");

Where my janusgraph.properties file is as follows:

gremlin.graph=org.janusgraph.core.JanusGraphFactory
storage.backend=hbase
storage.hostname=127.0.0.1

cache.db-cache = true
cache.db-cache-clean-wait = 20
cache.db-cache-time = 180000
cache.db-cache-size = 0.5

index.janusgraph-index.backend=lucene

However, when I try to connect I get the following error:

Exception in thread "Thread-4" java.lang.RuntimeException: GraphFactory could not instantiate this Graph implementation [class org.janusgraph.core.JanusGraphFactory]
    at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:82)
    at org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:70)
    at uk.gov.nca.cdp.graphutils.server.controllers.MergeGraph.lambda$merge$0(MergeGraph.java:26)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
    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 org.apache.tinkerpop.gremlin.structure.util.GraphFactory.open(GraphFactory.java:78)
    ... 3 more
Caused by: java.lang.IllegalArgumentException: Could not find implementation class: org.janusgraph.diskstorage.es.ElasticSearchIndex
    at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:61)
    at org.janusgraph.diskstorage.Backend.getImplementationClass(Backend.java:477)
    at org.janusgraph.diskstorage.Backend.getIndexes(Backend.java:464)
    at org.janusgraph.diskstorage.Backend.<init>(Backend.java:149)
    at org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.getBackend(GraphDatabaseConfiguration.java:1897)
    at org.janusgraph.graphdb.database.StandardJanusGraph.<init>(StandardJanusGraph.java:136)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:164)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:133)
    at org.janusgraph.core.JanusGraphFactory.open(JanusGraphFactory.java:113)
    ... 8 more
Caused by: java.lang.ClassNotFoundException: org.janusgraph.diskstorage.es.ElasticSearchIndex
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:94)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at org.janusgraph.util.system.ConfigurationUtil.instantiate(ConfigurationUtil.java:56)
    ... 16 more

This sounds like it's trying to use Elasticsearch rather than Lucene. How do I correctly configure it to use Lucene?

James Baker
  • 1,143
  • 17
  • 39

1 Answers1

4

The problem you are running into is that your configuration does not define a storage.hbase.table so the default table name janusgraph is used (see the JanusGraph configuration reference). An HBase table named janusgraph must have been previously created with Elasticsearch for the indexing provider. JanusGraph stores its initial configuration in the HBase table, so when you connect to the janusgraph table, it is reading the old properties from the janusgraph table. You should either:

  • Drop the existing janusgraph HBase table. From the HBase shell: disable 'janusgraph'; drop 'janusgraph';
  • Use a different HBase table by setting storage.hbase.table=mygraph

As described in the JanusGraph Lucene documentation, the Lucene indexing backend requires two parameters in its configuration:

  • index.[X].backend=lucene
  • index.[X].directory=/data/searchindex

where [X] is the name of the index. You could set this to match the directory name, searchindex, or search as commonly found in examples, or janusgraph-index as in your question. Make sure you include both configuration properties.

Misha Brukman
  • 12,938
  • 4
  • 61
  • 78
Jason Plurad
  • 6,682
  • 2
  • 18
  • 37