Serializing a JanusGraph subgraph in Gremlin-Java
John Ripley <riple...@...>
I am connecting to a remote JanusGraph 0.20 instance from Java. My client is using Tinkerpop 3.2.6. I can do all the standard stuff, return vertices, edges, etc. When I try to build a 2 generation subgraph in starting from a known seed Object o = g.V().has("id", 1).repeat(__.bothE().subgraph("subGraph").outV()).times(2).cap("subGraph").next(); I get the following exception: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Error during serialization: Class is not registered: org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph Note: To register this class use: kryo.register(org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.class); at org.apache.tinkerpop.gremlin.driver.Handler$GremlinResponseHandler.channelRead0(Handler.java:246) ~[gremlin-driver-3.3.1.jar:3.3.1] ... This same line works fine in the gremlin console. gremlin> sg = g.V().has('id', 1).repeat(bothE().subgraph('subGraph').bothV()).times(3).cap('subGraph').next() ==>tinkergraph[vertices:4 edges:4] I am using the out of the box JanusGraph 0.20 gremlin-server.yaml and remote-objects.yaml |
|
Stephen Mallette <spmal...@...>
Seems like you driver isn't configured to use the TinkerIoRegistry which will allow it to deserialize TinkerGraph instances: On Thu, Apr 5, 2018 at 5:58 PM, John Ripley <riple...@...> wrote:
|
|
John Ripley <riple...@...>
I add the serializer to my client side remote-objects.yaml and got a little further. hosts: [127.0.0.1] port: 8182 serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }, className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0] } } Do I need to pair this with a gremin-server.yaml entry? This is the Janus 0.2.0 version that I am using host: 0.0.0.0 port: 8182 scriptEvaluationTimeout: 30000 channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer graphs: { graph: conf/gremlin-server/janusgraph-cassandra-es-server.properties } plugins: - janusgraph.imports scriptEngines: { gremlin-groovy: { imports: [java.lang.Math], staticImports: [java.lang.Math.PI], scripts: [scripts/empty-sample.groovy]}} serializers: - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistry] }} - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0, config: {ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { serializeResultToString: true }} - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }} - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} - { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistryV1d0] }} processors: - { className: org.apache.tinkerpop.gremlin.server.op.session.SessionOpProcessor, config: { sessionTimeout: 28800000 }} - { className: org.apache.tinkerpop.gremlin.server.op.traversal.TraversalOpProcessor, config: { cacheExpirationTime: 600000, cacheMaxSize: 1000 }} metrics: { consoleReporter: {enabled: true, interval: 180000}, csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv}, jmxReporter: {enabled: true}, slf4jReporter: {enabled: true, interval: 180000}, gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST}, graphiteReporter: {enabled: false, interval: 180000}} maxInitialLineLength: 4096 maxHeaderSize: 8192 maxChunkSize: 8192 maxContentLength: 65536 maxAccumulationBufferComponents: 1024 resultIterationBatchSize: 64 writeBufferLowWaterMark: 32768 writeBufferHighWaterMark: 65536 Also, it seems that JanusGraph is on tp 3.2.6 and my client needs to import tp 3.3.x for it to correctly find your above mentioned serializer. Will JanusGraph need to upgrade to tp 3.3.x for the server side serializer to work? On Thursday, April 5, 2018 at 5:01:12 PM UTC-5, John Ripley wrote:
|
|
John Ripley <riple...@...>
I was able to get it to work by including both JanusGraph and TinkerPop IoRegistries on both server and client Tinkerpop 3.2.6 on (Janus 0.2.0) gremlin server and client gremlin-server.yaml ... serializers: - { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistry,org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }} ... remote-objects.yaml hosts: [127.0.0.1] port: 8182 serializer: { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistry,org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] } } If I include only TinkIoRegistry, it complains about not being able to handle certain JanusGraph classes. If I just include JanusGraphIoRegistry, it complains about not being able to handle certain Tinkerpop classes. Thanks for your help, Stephen On Thursday, April 5, 2018 at 5:01:12 PM UTC-5, John Ripley wrote:
|
|
Fred Eisele <fredric...@...>
I am getting the same errors you got but the fix is not doing it for me. ```yaml hosts: [localhost] port: 8182 serializer: className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0 config: ioRegistries: - org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerIoRegistryV3d0 - org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry ``` ```text Exception in thread "main" java.util.concurrent.CompletionException: org.apache.tinkerpop.gremlin.driver.exception.ResponseException: Error during serialization: Class is not registered: org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph Note: To register this class use: kryo.register(org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph.class); at java.base/java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:412) ``` Meanwhile the groovy-gremlin-client works fine and it makes no mention of the TinkerIoRegistryV3d0. On Friday, April 6, 2018 at 8:30:07 PM UTC-5 ri...@... wrote:
|
|