Getting "Encountered unregistered class ID" from gremlin server

1,055 views
Skip to first unread message

Al Byers

unread,
Aug 18, 2018, 2:18:20 PM8/18/18
to Gremlin-users
Running JanusGraph 0.3.0 "getting started" setup with cassandra.

Edge e = g.V(fromVertex.id()).as('a').V(toVertex.id()).addE(label).from('a').next()

It works in the console. Here is my config setup:
protected String contactPoint = "localhost"
protected int port = 8182
protected serializer = new org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0()
...
Cluster.Builder builder = Cluster.build()
builder
.addContactPoint(contactPoint)
builder
.port(port)
builder
.serializer(serializer)
cluster = builder.create()


This is the error message.

12:06:33.537 ERROR river-loop-3 e.t.g.d.Handler$GremlinResponseHandler Could not process the response
io.netty.handler.codec.DecoderException: org.apache.tinkerpop.gremlin.driver.ser.SerializationException: org.apache.tinkerpop.shaded.kryo.KryoException: Encountered unregistered class ID: 65536
Serialization trace:
id (org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdge)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98) ~[netty-all-4.1.28.Final.jar:4.1.28.Final]

Do I need to register ReferenceEdge? How would I go about doing that?

Al Byers

unread,
Aug 20, 2018, 10:14:16 AM8/20/18
to Gremlin-users
Looks like this might explain it

Al Byers

unread,
Aug 20, 2018, 1:11:41 PM8/20/18
to Gremlin-users
I thought I would just circumvent the problem by returning the edge id, as in:

String id = g.V(fromVertex).as('a').V(toVertex.id()).addE(label).from('a').id().next()


But that throws the following error:


io.netty.handler.codec.DecoderException: org.apache.tinkerpop.gremlin.driver.ser.SerializationException: org.apache.tinkerpop.shaded.kryo.KryoException: Encountered unregistered class ID: 65536
java.util.concurrent.CompletionException: io.netty.handler.codec.DecoderException: org.apache.tinkerpop.gremlin.driver.ser.SerializationException: org.apache.tinkerpop.shaded.kryo.KryoException: Encountered unregistered class ID: 65536
at java.util.concurrent.CompletableFuture.reportJoin(CompletableFuture.java:375)
at java.util.concurrent.CompletableFuture.join(CompletableFuture.java:1934)
at org.apache.tinkerpop.gremlin.driver.ResultSet.one(ResultSet.java:107)
at org.apache.tinkerpop.gremlin.driver.ResultSet$1.hasNext(ResultSet.java:159)
at org.apache.tinkerpop.gremlin.driver.ResultSet$1.next(ResultSet.java:166)
at org.apache.tinkerpop.gremlin.driver.ResultSet$1.next(ResultSet.java:153)
at org.apache.tinkerpop.gremlin.driver.remote.DriverRemoteTraversal$TraverserIterator.next(DriverRemoteTraversal.java:142)

Why can I not return the id?

Stephen Mallette

unread,
Aug 20, 2018, 5:14:55 PM8/20/18
to Gremlin-users
I think that this issue is somewhat specific to JanusGraph so you might want to take your question to their list for more focused attention, but from a TinkerPop perspective, the error is basically saying that you don't have a way to resolve a JanusGraph identifier on the client - in other words, when the client gets the id back it has no idea what object to serialize it into. I don't remember how JanusGraph deals with that...maybe one of the JanusGraph folks can chime in here.

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/2694376a-aeef-41bc-96a2-8789bcdf836b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Robert Dale

unread,
Aug 20, 2018, 5:16:23 PM8/20/18
to gremli...@googlegroups.com
Need to set the JanusGraph registry:

https://docs.janusgraph.org/latest/server.html#gremlin-server-with-janusgraph
GryoMapper mapper = GryoMapper.build().addRegistry(JanusGraphIoRegistry.INSTANCE).create();
Cluster cluster = Cluster.build().serializer(new GryoMessageSerializerV1d0(mapper)).create();
Client client = cluster.connect();
client.submit("g.V()").all().get();

Robert Dale


Al Byers

unread,
Aug 21, 2018, 10:24:14 AM8/21/18
to Gremlin-users
Thanks for this help. I am moving my gremlin server off my laptop onto another machine and that is presenting its own problems. When those are resolved, I will test this.

As an aside, I was running JanusGraph, Cassandra and Elasticsearch in a Windows Subsystem for Linux app on an 8GB laptop and it seemed to be working (I was able to run, connect and use gremlin server) but then it seemed like it was dropping out processes like my IDE and browser so I am running it on another WSL session on another dedicated machine. I opened the firewall but it is still giving me RemoteExceptions in the console and timeout errors from a groovy client. Fun times.

Al Byers

unread,
Aug 27, 2018, 4:31:10 PM8/27/18
to Gremlin-users
So, this is hard. :0)

I set up my server to run the JanusGraph 0.3.0 version of Gremlin Server

I modified my code per Robert's suggestions (though there were some issues, which I noted):

JanusGraphIoRegistry registry = JanusGraphIoRegistry.getInstance()
JanusGraphIoRegistry registry2 = JanusGraphIoRegistry.INSTANCE // Why does this even work? INSTANCE is marked as private
GryoMapper.Builder mapperBuilder = GryoMapper.build().addRegistry(registry)
GryoMapper mapper = mapperBuilder.create()
serializer = new org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0(mapperBuilder) // Does it matter if it is V3 or V1
                                                       
// The api calls for GryoMapper.Builder as the argument to the constructor, but the JanusGraph docs
                                                       
// show GryoMapper. The Builder does not cause compile errors, but Mapper does

Cluster.Builder builder = Cluster.build()
builder
.addContactPoint(contactPoint)
builder
.port(port)
builder
.serializer(serializer)
cluster = builder.create()

...
GraphTraversalSource getTraversal() {
   
return graph.traversal().withRemote(DriverRemoteConnection.using(cluster, "g"))
}

org
.apache.tinkerpop.gremlin.driver.Client getClient() {
   
return cluster.connect()
}

I tried my original approach:
Edge e = g.V(fromId).as('a').V(toId).addE(label).from('a').next()

and using "Client":
String eStr = "g.V('${fromId}').as('a').V('${toId}').addE('${label}').from('a').next()"
org.apache.tinkerpop.gremlin.driver.ResultSet result = client.submit(eStr)
CompletableFuture <Edge> cf = result.all()
Edge e2 = cf.get()

Both gave the same results, though the Client approach did not show as much detail - did not identify the "unregister class" as "ReferenceEdge":
20:34:12.309  WARN river-loop-3       o.apache.t.g.d.MessageSerializer Response [PooledUnsafeDirectByteBuf(ridx: 117, widx: 117, cap: 117)] could not be deserialized by org.apache.tinkerpop.gremlin.driver.ser.AbstractGryoMessageSerializerV3d0.
org.apache.tinkerpop.shaded.kryo.KryoException: Encountered unregistered class ID: 65536
Serialization trace:
id (org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdge)
at org.apache.tinkerpop.gremlin.structure.io.gryo.AbstractGryoClassResolver.readClass(AbstractGryoClassResolver.java:148) ~[gremlin-core-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.shaded.kryo.Kryo.readClass(Kryo.java:667) ~[gremlin-shaded-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.shaded.kryo.serializers.ObjectField.read(ObjectField.java:118) ~[gremlin-shaded-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.shaded.kryo.serializers.FieldSerializer.read(FieldSerializer.java:557) ~[gremlin-shaded-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.shaded.kryo.Kryo.readClassAndObject(Kryo.java:787) ~[gremlin-shaded-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim.shaded.ShadedKryoAdapter.readClassAndObject(ShadedKryoAdapter.java:39) ~[gremlin-core-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim.shaded.ShadedKryoAdapter.readClassAndObject(ShadedKryoAdapter.java:24) ~[gremlin-core-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.gremlin.structure.io.gryo.GryoSerializersV3d0$DefaultRemoteTraverserSerializer.read(GryoSerializersV3d0.java:395) ~[gremlin-core-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.gremlin.structure.io.gryo.GryoSerializersV3d0$DefaultRemoteTraverserSerializer.read(GryoSerializersV3d0.java:386) ~[gremlin-core-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim.shaded.ShadedSerializerAdapter.read(ShadedSerializerAdapter.java:52) ~[gremlin-core-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.shaded.kryo.Kryo.readClassAndObject(Kryo.java:787) ~[gremlin-shaded-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.shaded.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:134) ~[gremlin-shaded-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.shaded.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:40) ~[gremlin-shaded-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.shaded.kryo.Kryo.readClassAndObject(Kryo.java:787) ~[gremlin-shaded-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim.shaded.ShadedKryoAdapter.readClassAndObject(ShadedKryoAdapter.java:39) ~[gremlin-core-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim.shaded.ShadedKryoAdapter.readClassAndObject(ShadedKryoAdapter.java:24) ~[gremlin-core-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.gremlin.driver.ser.ResponseMessageGryoSerializer.read(ResponseMessageGryoSerializer.java:56) ~[gremlin-driver-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.gremlin.driver.ser.ResponseMessageGryoSerializer.read(ResponseMessageGryoSerializer.java:34) ~[gremlin-driver-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.gremlin.structure.io.gryo.kryoshim.shaded.ShadedSerializerAdapter.read(ShadedSerializerAdapter.java:52) ~[gremlin-core-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.shaded.kryo.Kryo.readObject(Kryo.java:683) ~[gremlin-shaded-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.gremlin.driver.ser.AbstractGryoMessageSerializerV3d0.deserializeResponse(AbstractGryoMessageSerializerV3d0.java:155) [gremlin-driver-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.gremlin.driver.handler.WebSocketGremlinResponseDecoder.decode(WebSocketGremlinResponseDecoder.java:50) [gremlin-driver-3.3.3.jar:3.3.3]
at org.apache.tinkerpop.gremlin.driver.handler.WebSocketGremlinResponseDecoder.decode(WebSocketGremlinResponseDecoder.java:37) [gremlin-driver-3.3.3.jar:3.3.3]


I debugged as far as possible to determine that ReferenceEdge is contained in the GryoMapper.typeRegistrations:
g.connection::client::client::cluster::manager::serializer::typeRegistrations:
...
org.apache.tinkerpop.gremlin.structure.io.gryo.GryoTypeReg@411bc3f5[targetClass=class org.apache.tinkerpop.gremlin.structure.util.reference.ReferenceEdge,id=81,shadedSerializer=<null>,serializerShim=<null>,functionOfShadedKryo=<null>]

Any suggestions on what to do next?


Jason Plurad

unread,
Aug 28, 2018, 4:46:23 PM8/28/18
to Gremlin-users
Hi Al,

I created a standalone example on how to do this https://github.com/pluradj/janusgraph-remote-java-example

Things to watch out for:
1. make sure your GryoMessageSerializerV3d0 versions are aligned
   a. in the gremlin-server.yaml
   b. in the remote-objects.yaml (when using Java GLV)
   c. in the Cluster config (when using Java driver)
2. make sure the JanusGraphIoRegistry is configured in all of those places

Stephen Mallette

unread,
Aug 28, 2018, 4:48:37 PM8/28/18
to Gremlin-users
nice jason...thanks for doing that.

so much user configuration - too bad that didn't come out as nicely as envisioned in TinkerPop. :( 

Al Byers

unread,
Aug 28, 2018, 7:47:44 PM8/28/18
to Gremlin-users
Just changed the instances of "localhost" to my remote ip and it worked like a charm. 
Thanks. This kind of help is invaluable.

Jason Plurad

unread,
Aug 28, 2018, 7:54:30 PM8/28/18
to Gremlin-users
There's an open issue to clean up some of the config files in JanusGraph which hopefully would make this easier.
Reply all
Reply to author
Forward
0 new messages