Gremlin-driver无法得到titandb的回应

问题描述 投票:2回答:1

我正在尝试使用gremlin-driver通过WebSockets查询服务器titan实例。所以我有下一个依赖:

    <dependency>
        <groupId>org.apache.tinkerpop</groupId>
        <artifactId>gremlin-driver</artifactId>
        <version>3.1.1-incubating</version>
    </dependency>

尝试使用next命令获取值:

       List<Result> some = client.submit("g.V().has(T.label, marketplace).has('marketplace_product_id', marketplace_product_id)", params).some(1).get();

并获得下一个例外:

 WARN  o.a.t.g.driver.MessageSerializer - Response [PooledUnsafeDirectByteBuf(ridx: 136, widx: 136, cap: 136)] could not be deserialized by org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0.
13:41:36.879 [gremlin-driver-loop-1] ERROR o.a.t.g.d.Handler$GremlinResponseHandler - Could not process the response
io.netty.handler.codec.DecoderException: org.apache.tinkerpop.gremlin.driver.ser.SerializationException: java.lang.IndexOutOfBoundsException: Index: 121, Size: 0

没有在网上找到一个关于使用gremlin-driver进行CRUD操作的可行示例。有谁知道如何处理?

编辑1:使用titan-1.0.0-hadoop1尝试使用驱动程序版本3.0.1-incubating并获得几乎相同的IndexOutOfBoundsException。

java titan gremlin
1个回答
1
投票

试试这个:可能会有所帮助

List<Result> some = null; 
some = client.submit("g.V()
                 .has(T.label,marketplace)
                 .has('marketplace_product_id', marketplace_product_id)")
             .stream()**
             .map(r -> r.get(Vertex.class))**
             .collect(Collectors.toList());
© www.soinside.com 2019 - 2024. All rights reserved.