0

I have the following code:

trait InMemoryConnectScala {

  def messageSerializer(): MessageSerializer = {
    import java.util.Collections

    import org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0
    import org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry
    val config = new util.HashMap[String, Object]()
    config.put("ioRegistries", Collections.singletonList(classOf[JanusGraphIoRegistry].getName))
    val serializer = new GryoMessageSerializerV1d0()
    serializer.configure(config, null)
    serializer
  }
  def connect(): JanusGraph = {
    import org.apache.commons.configuration.BaseConfiguration
    val conf = new BaseConfiguration()
    conf.setProperty("storage.backend", "inmemory")
    conf.setProperty("type", "remote")

    val jg = JanusGraphFactory.open(conf)

    jg
  }
}

val clusterBuilder = Cluster.build.port(8182).serializer(messageSerializer()).addContactPoint("localhost")

    val cl = clusterBuilder.create()
    val client: Client = cl.connect()

    val jg = EmptyGraph.instance.traversal.withRemote(DriverRemoteConnection.using(cl))

    val res = client.submit("g.V().count()")
  }

I get the following error when it hits the submit method

12:25:34.979 [pool-1-thread-1] INFO  o.a.t.gremlin.driver.ConnectionPool - Opening connection pool on Host{address=localhost/127.0.0.1:8182, hostUri=ws://localhost:8182/gremlin} with core size of 2
[info] AcmTestSpec *** ABORTED ***
[info]   java.lang.RuntimeException: java.lang.RuntimeException: java.util.concurrent.TimeoutException: Timed out while waiting for an available host - check the client configuration and connectivity to the server if this message persists
[info]   at org.apache.tinkerpop.gremlin.driver.Client.submit(Client.java:214)
[info]   at org.apache.tinkerpop.gremlin.driver.Client.submit(Client.java:198)
[info]   at AcmTestSpec.beforeAll(AcmTestSpec.scala:407)
[info]   at org.scalatest.BeforeAndAfterAll.liftedTree1$1(BeforeAndAfterAll.scala:212)
[info]   at org.scalatest.BeforeAndAfterAll.run(BeforeAndAfterAll.scala:210)
[info]   at org.scalatest.BeforeAndAfterAll.run$(BeforeAndAfterAll.scala:208)
[info]   at AcmTestSpec.run(AcmTestSpec.scala:60)
Misha Brukman
  • 12,938
  • 4
  • 61
  • 78
allthenutsandbolts
  • 1,513
  • 1
  • 13
  • 34
  • Please state your specific question and perhaps describe what you are trying to accomplish rather than sharing your code only. It is not clear to me what this code is attempting to do. – Jason Plurad Mar 11 '18 at 22:11
  • Code is just trying to attempt and run a query trying to count the Vertices – allthenutsandbolts Mar 12 '18 at 23:07
  • 1
    Can you discuss your test configuration and graph setup? In `def connect()` you are creating an in-memory graph, but then with `clusterBuilder` you are trying to create a remote connection to a Gremlin Server. I am not sure what you are trying to do exactly. For example, it is not clear that you have a Gremlin Server running before running the test. – Jason Plurad Mar 13 '18 at 02:00
  • Let me check, what I essential need is a client where I can send in RAW Gremlin Queries to Janus – allthenutsandbolts Mar 14 '18 at 04:06
  • 1. How did you start janusgraph? 2. Snapshot of the console/terminal after you started janusgraph – Srinath Ganesh Apr 19 '18 at 05:26

0 Answers0