Search code examples
gremlinjanusgraphgremlin-server

Get " Class is not registered:" exception during Gremlin Query


I'm using Gremlin to connect with Janusgraph. Right now, I'd like to program a gremlin query statement to get specific Vertex by label with ignoring case-sensitive. So, my query like this:

g.V(vertexId).inE(edgeLabel).outV().filter(it -> it.get().label().equalsIgnoreCase(label)) ;

However, the execution caused a exception:

java.lang.IllegalArgumentException: Class is not registered: com.demo.service.kg.KGService$$Lambda$506/1884099229 Note: To register this class use: kryo.register(com.demo.service.kg.KGService$$Lambda$506/1884099229.class);

My configuration is:

hosts: [localhost]
port: 8182
connectionPool: { maxContentLength: 7000000 }
serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, 
          config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry], 
serializeResultToString: true}}

Is there anyone knows what is going on?


Solution

  • Lambdas will not serialize that way. You have to submit them as strings

    g.V(vertexId).inE(edgeLabel).outV().filter(
      Lambda.predicate("it -> it.get().label().equalsIgnoreCase(label)")) ;