The little bit I posted was the full message back but I have some additional information from the server console.
I'll try and provide more information from my testing.
Starting gremlin-server with my configuration (from a few posts back) and a virgin neo4j graph.
- All requests are made against the session opProcessor. There's no difference if they're in the same session or not. There are however NO issues in the standard opProcessor.
- All requests are made against a Neo4j graph. There are no issues with tinkergraph.
- All requests are made within a binary websocket frame using application/json as the mimeType.
requesting n.V works as expected (returns empty set) but the server output gives the following warning:
[WARN] GremlinExecutor - Could not initialize gremlin-groovy ScriptEngine with scripts/generate-classic.groovy as script could not be evaluated - javax.script.ScriptException: java.lang.IllegalArgumentException: Vertex with id already exists: 1
requesting n.addVertex() returns an error : Error during serialization: (was java.util.NoSuchElementException) (through reference chain: java.util.HashMap["result"]->java.util.ArrayList[0])
It's worth noting that the vertex is created. And the server console output is :
[INFO] Session - New session established for 6acefc06-b3f7-4e80-a8f4-6c9a65b9400d
[INFO] ScriptEngines - Loaded nashorn ScriptEngine
[INFO] ScriptEngines - Loaded gremlin-groovy ScriptEngine
[INFO] GremlinExecutor - Getting dependencies for [[com.tinkerpop, neo4j-gremlin, 3.0.0.M1]]
[INFO] GremlinExecutor - Getting dependencies for [[org.apache.commons, commons-math3, 3.2]]
[WARN] GremlinExecutor - Could not initialize gremlin-groovy ScriptEngine with scripts/generate-classic.groovy as script could not be evaluated - javax.script.ScriptException: java.lang.IllegalArgumentException: Vertex with id already exists: 1
[WARN] AbstractJsonMessageSerializerV1d0 - Response [ResponseMessage{requestId=f6a128f9-f534-4445-a9d4-ed158c6f795e, code=SUCCESS, result=[v[1]], resultType=COLLECTION}] could not be serialized by com.tinkerpop.gremlin.driver.ser.AbstractJsonMessageSerializerV1d0.
[WARN] WsGremlinResponseEncoder - The result [[v[1]]] in the request f6a128f9-f534-4445-a9d4-ed158c6f795e could not be serialized and returned.
com.tinkerpop.gremlin.driver.ser.SerializationException: com.fasterxml.jackson.databind.JsonMappingException: (was java.util.NoSuchElementException) (through reference chain: java.util.HashMap["result"]->java.util.ArrayList[0])
at com.tinkerpop.gremlin.driver.ser.AbstractJsonMessageSerializerV1d0.serializeResponseAsBinary(AbstractJsonMessageSerializerV1d0.java:59)
at com.tinkerpop.gremlin.server.handler.WsGremlinResponseEncoder.encode(WsGremlinResponseEncoder.java:36)
at com.tinkerpop.gremlin.server.handler.WsGremlinResponseEncoder.encode(WsGremlinResponseEncoder.java:24)
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658)
at io.netty.channel.AbstractChannelHandlerContext.access$2000(AbstractChannelHandlerContext.java:32)
at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:939)
at io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:991)
at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:924)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:370)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: (was java.util.NoSuchElementException) (through reference chain: java.util.HashMap["result"]->java.util.ArrayList[0])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:232)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:211)
at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:212)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:105)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:21)
at com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase.serialize(AsArraySerializerBase.java:183)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:467)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:388)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:27)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:114)
at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:2811)
at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsBytes(ObjectMapper.java:2292)
at com.tinkerpop.gremlin.driver.ser.AbstractJsonMessageSerializerV1d0.serializeResponseAsBinary(AbstractJsonMessageSerializerV1d0.java:50)
... 13 more
Caused by: java.util.NoSuchElementException
at java.util.ArrayList$Itr.next(ArrayList.java:854)
at com.tinkerpop.gremlin.neo4j.structure.Neo4jElement.label(Neo4jElement.java:43)
at com.tinkerpop.gremlin.neo4j.structure.Neo4jVertex.label(Neo4jVertex.java:24)
at com.tinkerpop.gremlin.structure.io.graphson.GraphSONModule$VertexJacksonSerializer.ser(GraphSONModule.java:90)
at com.tinkerpop.gremlin.structure.io.graphson.GraphSONModule$VertexJacksonSerializer.serialize(GraphSONModule.java:76)
at com.tinkerpop.gremlin.structure.io.graphson.GraphSONModule$VertexJacksonSerializer.serialize(GraphSONModule.java:67)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:100)
... 22 more
After this error, any subsequent n.V scripts I run throw an error. Here's the console output for the first run:
[INFO] Session - New session established for 60661585-ff1b-430a-9037-9b90b13c68ad
[INFO] ScriptEngines - Loaded nashorn ScriptEngine
[INFO] ScriptEngines - Loaded gremlin-groovy ScriptEngine
[INFO] GremlinExecutor - Getting dependencies for [[com.tinkerpop, neo4j-gremlin, 3.0.0.M1]]
[INFO] GremlinExecutor - Getting dependencies for [[org.apache.commons, commons-math3, 3.2]]
[WARN] GremlinExecutor - Could not initialize gremlin-groovy ScriptEngine with scripts/generate-classic.groovy as script could not be evaluated - javax.script.ScriptException: java.lang.IllegalArgumentException: Vertex with id already exists: 1
[WARN] AbstractJsonMessageSerializerV1d0 - Response [ResponseMessage{requestId=e55fc8c4-49c3-4f4e-a293-10065712cec5, code=SUCCESS, result=[v[2]], resultType=COLLECTION}] could not be serialized by com.tinkerpop.gremlin.driver.ser.AbstractJsonMessageSerializerV1d0.
[WARN] WsGremlinResponseEncoder - The result [[v[2]]] in the request e55fc8c4-49c3-4f4e-a293-10065712cec5 could not be serialized and returned.
com.tinkerpop.gremlin.driver.ser.SerializationException: com.fasterxml.jackson.databind.JsonMappingException: (was java.util.NoSuchElementException) (through reference chain: java.util.HashMap["result"]->java.util.ArrayList[0])
at com.tinkerpop.gremlin.driver.ser.AbstractJsonMessageSerializerV1d0.serializeResponseAsBinary(AbstractJsonMessageSerializerV1d0.java:59)
at com.tinkerpop.gremlin.server.handler.WsGremlinResponseEncoder.encode(WsGremlinResponseEncoder.java:36)
at com.tinkerpop.gremlin.server.handler.WsGremlinResponseEncoder.encode(WsGremlinResponseEncoder.java:24)
at io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:89)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:658)
at io.netty.channel.AbstractChannelHandlerContext.access$2000(AbstractChannelHandlerContext.java:32)
at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.write(AbstractChannelHandlerContext.java:939)
at io.netty.channel.AbstractChannelHandlerContext$WriteAndFlushTask.write(AbstractChannelHandlerContext.java:991)
at io.netty.channel.AbstractChannelHandlerContext$AbstractWriteTask.run(AbstractChannelHandlerContext.java:924)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:370)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116)
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.fasterxml.jackson.databind.JsonMappingException: (was java.util.NoSuchElementException) (through reference chain: java.util.HashMap["result"]->java.util.ArrayList[0])
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:232)
at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:211)
at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:212)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:105)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:21)
at com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase.serialize(AsArraySerializerBase.java:183)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:467)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:388)
at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:27)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:114)
at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:2811)
at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsBytes(ObjectMapper.java:2292)
at com.tinkerpop.gremlin.driver.ser.AbstractJsonMessageSerializerV1d0.serializeResponseAsBinary(AbstractJsonMessageSerializerV1d0.java:50)
... 13 more
Caused by: java.util.NoSuchElementException
at java.util.ArrayList$Itr.next(ArrayList.java:854)
at com.tinkerpop.gremlin.neo4j.structure.Neo4jElement.label(Neo4jElement.java:43)
at com.tinkerpop.gremlin.neo4j.structure.Neo4jVertex.label(Neo4jVertex.java:24)
at com.tinkerpop.gremlin.structure.io.graphson.GraphSONModule$VertexJacksonSerializer.ser(GraphSONModule.java:90)
at com.tinkerpop.gremlin.structure.io.graphson.GraphSONModule$VertexJacksonSerializer.serialize(GraphSONModule.java:76)
at com.tinkerpop.gremlin.structure.io.graphson.GraphSONModule$VertexJacksonSerializer.serialize(GraphSONModule.java:67)
at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:100)
... 22 more
I've managed to figure out to some extend why the following n.V scripts fail.
if I do the following ( 2 different requests using the same session):
n.addVertex();5 //have to add ;5 to keep my driver from throwing an exception
n.tx().commit()
Then start a new session and run :
n.V
I get no errors. Which tells me :
- adding a vertex in a session without committing it, then requesting vertices for said graph returns particular output that can't be serialized.
- gremlin server doesn't rollback on this serializing error? (one possibility)
- Drivers (when in session mode) should auto commit changes before closing the connection because users don't always start the transaction but it exists nonetheless.
Of course this doesn't explain the original error on n.addVertex() in session mode.
If there's any other info or stuff you want me to test let me know.