Deserializer for "orient:ORecordId" not found

#1

Hi All,

When I tried to query orientDB graph instance using Gremlin . Net, the query is executed correctly but always give me this “Deserializer for “orient:ORecordId” not found” exception when trying to parse server response.

at Gremlin.Net.Structure.IO.GraphSON.GraphSONReader.ReadTypedValue(JToken typedValue)
at Gremlin.Net.Structure.IO.GraphSON.VertexDeserializer.Objectify(JToken graphsonObject, GraphSONReader reader)
at Gremlin.Net.Structure.IO.GraphSON.GraphSONReader.ReadTypedValue(JToken typedValue)
at Gremlin.Net.Structure.IO.GraphSON.ListSerializer.Objectify(JToken graphsonObject, GraphSONReader reader)
at Gremlin.Net.Structure.IO.GraphSON.GraphSONReader.ReadTypedValue(JToken typedValue)
at Gremlin.Net.Driver.Connection.d__141.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Gremlin.Net.Driver.Connection.<SubmitAsync>d__81.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Gremlin.Net.Driver.ProxyConnection.d__31.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Gremlin.Net.Driver.GremlinClient.<SubmitAsync>d__61.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Gremlin.Net.Driver.GremlinClientExtensions.d__4`1.MoveNext()

Any suggestions?

Thanks!

#2

Are you able to find a solution for this. I am having the same problem.

My code looks like this:
var server = new GremlinServer(“localhost”, port: 8182, enableSsl: false, username: “root”, password: “rootpwd”);

        using (var client = new GremlinClient(server, new GraphSON3Reader(),  new GraphSON3Writer()))
        {
            await client.SubmitAsync<dynamic>("g.addV('person').property('name', 'bob')");
        }
#3

Did you find a solution for this?

#4

Hi @DiegoMartelli

the Record ID of ORientDB is custom serialized on network.

Is it possible to provide a custom serializer to Gremlin.NET for ids?

#5

Hi @wolf4ood,
thank you for reply.
After I read your suggestion I found the way to do it, but I’m struggling to find the right type name.
I tried identity, ORecordId and also com.orientechnologies.orient.core.id.ORecordId[“identity”])
new GraphSON2Reader(new Dictionary<string, IGraphSONDeserializer> { { “identity”, new RecordIdDeserializer() } })
but my custom class RecordIdDeserializer is never invoked.

#6

Hi @DiegoMartelli

did you try with orient:ORecordId ?

#7

I still get this:

ResponseException: ServerSerializationError: Error during serialization: Direct self-reference leading to cycle (through reference chain: java.util.ArrayList[0]->com.orientechnologies.orient.core.id.ORecordId[“identity”])

To be honest seems to be more a orientdb side problem. I fully replaced the deserializator with a custom one and I set a breakpoint in the deserialization and seems never be called.

#8

Hi @DiegoMartelli

are you using the OrientDB Tp3 distribution or the Gremlin Server directly?

Thanks

#9

I’m using orientdb-tp3-3.0.18 as it is. community edition. I thought it was ready for gremlin. Then I just run the server.bat.

#10

@DiegoMartelli

are you using the demodb?

Can you share the gremlin server configuration?

#11

yes, I’m using the demodb and the configuration is as I downloaded it.

host: localhost
port: 8182
scriptEvaluationTimeout: 30000
channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer
graphManager : com.orientechnologies.tinkerpop.server.OrientGremlinGraphManager
graphs: {
graph : …/config/demodb.properties
}
scriptEngines: {
gremlin-groovy: {
plugins: { org.apache.tinkerpop.gremlin.server.jsr223.GremlinServerGremlinPlugin: {},
org.apache.tinkerpop.gremlin.orientdb.jsr223.OrientDBGremlinPlugin: {},
org.apache.tinkerpop.gremlin.jsr223.ImportGremlinPlugin: {classImports: [java.lang.Math], methodImports: [java.lang.Math#*]},
org.apache.tinkerpop.gremlin.jsr223.ScriptFileGremlinPlugin: {files: […/config/demodb.groovy]}}}}
serializers:

  • { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.orientdb.io.OrientIoRegistry] }} # application/vnd.gremlin-v3.0+gryo
  • { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV3d0, config: { serializeResultToString: true }} # application/vnd.gremlin-v3.0+gryo-stringd
  • { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV3d0, config: { ioRegistries: [org.apache.tinkerpop.gremlin.orientdb.io.OrientIoRegistry] }} # application/json
    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}}
    strictTransactionManagement: false
    maxInitialLineLength: 4096
    maxHeaderSize: 8192
    maxChunkSize: 8192
    maxContentLength: 65536
    maxAccumulationBufferComponents: 1024
    resultIterationBatchSize: 64
    writeBufferLowWaterMark: 32768
    writeBufferHighWaterMark: 65536
    authentication: {
    authenticator: com.orientechnologies.tinkerpop.server.auth.OGremlinServerAuthenticator
    }
    ssl: {
    enabled: false}
#12

@DiegoMartelli

Can you paste also the traversal that give you this error?

Thanks

#13

this is the gremlin: g.V(“33:5”)

#14

@DiegoMartelli

i’ve done the setup with .NET let me try it

Thanks

#15

Hi @DiegoMartelli

this is working for me

using System;
using static Gremlin.Net.Process.Traversal.AnonymousTraversalSource;
using static Gremlin.Net.Process.Traversal.__;
using static Gremlin.Net.Process.Traversal.P;
using static Gremlin.Net.Process.Traversal.Order;
using static Gremlin.Net.Process.Traversal.Operator;
using static Gremlin.Net.Process.Traversal.Pop;
using static Gremlin.Net.Process.Traversal.Scope;
using static Gremlin.Net.Process.Traversal.TextP;
using static Gremlin.Net.Process.Traversal.Column;
using static Gremlin.Net.Process.Traversal.Direction;
using static Gremlin.Net.Process.Traversal.T;
using Gremlin.Net.Driver.Remote;
using Gremlin.Net.Driver;
using Gremlin.Net.Structure.IO.GraphSON;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;

namespace gremlinExample
{
    class Program
    {
        static void Main(string[] args)
        {

            var dictionary = new Dictionary<string, IGraphSONDeserializer>
            {
                { "orient:ORecordId", new ORidDeserializer() },
            };

            var reader = new GraphSON3Reader(dictionary);

        
            
            var remoteConnection = new DriverRemoteConnection(new GremlinClient(new GremlinServer("localhost", 8182, username: "root", password: "root"), graphSONReader : reader));
            
            var g = Traversal().WithRemote(remoteConnection);

            Console.WriteLine(g.V("33:5").ToList());
        }
    }

    class ORidDeserializer : IGraphSONDeserializer
    {
        public dynamic Objectify(JToken graphsonObject, GraphSONReader reader)
        {
            return new ORecordId(graphsonObject.ToString());
        }
    }

    class ORecordId {

        private String rid;

        public ORecordId(String rid) {
            this.rid = rid; 
        }
    }
}

Let me know if this helps

#16

Thank to your code I found the error on mine.

using (var gremlinClient = new GremlinClient(gremlinServer, new GraphSON3Reader(new Dictionary<string, IGraphSONDeserializer> { { “orient:ORecordId”, new ORidDeserializer() } }), new GraphSON3Writer(), GremlinClient.GraphSON2MimeType))

it was that: GremlinClient.GraphSON2MimeType :frowning: