Serialization Issue

I have a weird error, when I am connecting with JanusGraph gremlin client using conf/remote-graph-binary.yaml I am able to get results. But when I am trying to use my java application I am getting, java.io.IOException: Serializer for custom type 'janusgraph.RelationIdentifier' not found. Googling around I got that this is due to serialization issue. It looks to me that the gremlin-client and my java application has similar configs but gremlin-client is not having any serialization problem.
hosts: [localhost]
port: 8182
serializer: { className: org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
hosts: [localhost]
port: 8182
serializer: { className: org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1, config: { ioRegistries: [org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry] }}
Code setting up the serialization:
import org.apache.tinkerpop.gremlin.structure.io.binary.TypeSerializerRegistry;
import org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry;
import org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1;
...
TypeSerializerRegistry typeSerializerRegistry = TypeSerializerRegistry.build()
.addRegistry(JanusGraphIoRegistry.getInstance())
.create();

// Build cluster and connect client
Cluster cluster = Cluster.build(host)
.port(port)
.serializer(new GraphBinaryMessageSerializerV1(typeSerializerRegistry))
.maxConnectionPoolSize(1)
.minConnectionPoolSize(1)
.maxInProcessPerConnection(1)
.minSimultaneousUsagePerConnection(1)
.maxSimultaneousUsagePerConnection(1)
.create();
Client client = cluster.connect();
...
import org.apache.tinkerpop.gremlin.structure.io.binary.TypeSerializerRegistry;
import org.janusgraph.graphdb.tinkerpop.JanusGraphIoRegistry;
import org.apache.tinkerpop.gremlin.util.ser.GraphBinaryMessageSerializerV1;
...
TypeSerializerRegistry typeSerializerRegistry = TypeSerializerRegistry.build()
.addRegistry(JanusGraphIoRegistry.getInstance())
.create();

// Build cluster and connect client
Cluster cluster = Cluster.build(host)
.port(port)
.serializer(new GraphBinaryMessageSerializerV1(typeSerializerRegistry))
.maxConnectionPoolSize(1)
.minConnectionPoolSize(1)
.maxInProcessPerConnection(1)
.minSimultaneousUsagePerConnection(1)
.maxSimultaneousUsagePerConnection(1)
.create();
Client client = cluster.connect();
...
Solution:
I have faced a similar issue in the past (but mostly related to gremlin-python) and @Boxuan Li suggested a solution in the JanusGraph discord server. It was something like along these lines: ``` private static MessageSerializer createGraphBinaryMessageSerializerV1() { final GraphBinaryMessageSerializerV1 serializer = new GraphBinaryMessageSerializerV1();...
GitHub
citegraph/backend/src/main/resources/gremlin-server-cql.yaml at mai...
CiteGraph: A citation graph web visualizer. Contribute to Citegraph/citegraph development by creating an account on GitHub.
Jump to solution
2 Replies
Valentyn Kahamlyk
there was similar issue https://discord.com/channels/838910279550238720/1118673121625522316, maybe this will help
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
Solution
rpuga
rpuga3mo ago
I have faced a similar issue in the past (but mostly related to gremlin-python) and @Boxuan Li suggested a solution in the JanusGraph discord server. It was something like along these lines:
private static MessageSerializer createGraphBinaryMessageSerializerV1() {
final GraphBinaryMessageSerializerV1 serializer = new GraphBinaryMessageSerializerV1();
final Map<String, Object> config = new HashMap<>();
config.put(GraphBinaryMessageSerializerV1.TOKEN_IO_REGISTRIES, Collections.singletonList(JanusGraphIoRegistry.class.getName()));
serializer.configure(config, Collections.emptyMap());
return serializer;
}
private static MessageSerializer createGraphBinaryMessageSerializerV1() {
final GraphBinaryMessageSerializerV1 serializer = new GraphBinaryMessageSerializerV1();
final Map<String, Object> config = new HashMap<>();
config.put(GraphBinaryMessageSerializerV1.TOKEN_IO_REGISTRIES, Collections.singletonList(JanusGraphIoRegistry.class.getName()));
serializer.configure(config, Collections.emptyMap());
return serializer;
}
and
Cluster cluster = Cluster.build()
.addContactPoint(gremlinServer)
.port(gremlinServerPort)
// .serializer(new GraphBinaryMessageSerializerV1(typeSerializerRegistry))
.serializer(createGraphBinaryMessageSerializerV1())
.create();
Cluster cluster = Cluster.build()
.addContactPoint(gremlinServer)
.port(gremlinServerPort)
// .serializer(new GraphBinaryMessageSerializerV1(typeSerializerRegistry))
.serializer(createGraphBinaryMessageSerializerV1())
.create();
Also, here is how he suggested to setup the serializers in the JanusGraph config file: https://github.com/Citegraph/citegraph/blob/main/backend/src/main/resources/gremlin-server-cql.yaml I hope this leads you closer to a solution.
GitHub
citegraph/backend/src/main/resources/gremlin-server-cql.yaml at mai...
CiteGraph: A citation graph web visualizer. Contribute to Citegraph/citegraph development by creating an account on GitHub.
Want results from more Discord servers?
Add your server
More Posts
Design decision related to multiple heterogenous relational graphsI'm working with over 100k instances of heterogeneous, relational node-and-edge attributed graphs, eStackoverflow when adding a larger list of property values using traverser.property()Hey, we encounter a stack overflow: ``` Exception during Transaction, rolling back ... org.apache.tijava: package org.apache.tinkerpop.shaded.jackson.core does not existWhile trying to `mvn clean install` with jdk11, I ran into the above error using the master branch. Performance issue in large graphsWhen performing changes in large graph (ca. 100K nodes, 500K edges) which is stored in one kryo fileConcurrent queries to authentication required sever resulted in 401 errorHey guys, playing around with gremlin & encountered this very odd error where concurrent queries wilDiscrepancy between console server id conventions and NeptuneSo I'm working with my test server and on Neptune--and I'm noticing a difference in the type of the how to connect the amothic/neptune container to the volume?I need to know which directory needs to attach to containeer. so that the data is stored safely. eveDocker yaml authentication settings (gremlinserver.authentication) questionDoes anyone have any experience setting up authentication on Docker by using the supplied .yaml fileGremlin Injection Attacks?Is anyone talking about or looking into attacks and mitigations for Gremlin Injection Attacks? That Returned vertex properties (JS client)Hi, I've got a question regarding the returned vertex value when using the JS client. How come non-a