1
votes

I'm trying to use Janusgraph in scala script with tinkerpop 3. I use the gremlin.scala library (https://github.com/mpollmeier/gremlin-scala) but I get an error about HNil (see below). How to use gremlin in scala script and Janusgraph ?

import gremlin.scala._
import org.apache.commons.configuration.BaseConfiguration
import org.janusgraph.core.JanusGraphFactory
import org.apache.tinkerpop.gremlin.structure.Graph

object Janus {
  def main(args: Array[String]): Unit = {
    val conf = new BaseConfiguration()
    conf.setProperty("storage.backend","inmemory")
    val graph = JanusGraphFactory.open(conf)
    val v1 = graph.graph.addV("test")
  }
}

Error:(11, 14) Symbol 'type scala.ScalaObject' is missing from the classpath. This symbol is required by 'trait shapeless.HNil'. Make sure that type ScalaObject is in your classpath and check for conflicting dependencies with -Ylog-classpath. A full rebuild may help if 'HNil.class' was compiled against an incompatible version of scala. val v1 = graph.graph.addV("test")

1

1 Answers

0
votes

Not sure what you mean by 'scala script', but it looks like you're missing many (all?) dependencies. Did you have a look at https://github.com/mpollmeier/gremlin-scala-examples/ ? It contains an example setup for janusgraph.