Neo4J & Serialization

95 views
Skip to first unread message

Johannes Mauerer

unread,
Jan 8, 2015, 1:38:24 AM1/8/15
to gremli...@googlegroups.com
Hi,

I'm running into another Serialization problem, this time around with Neo4J:
I'm running Gremlin Server 3.0.0.M6, connecting to Neo4J with the standard provided .yaml as config, just changing the path in the properties file. When I connect to the graph in gremlin console and run something simple as g.V().has('title', 'Avatar') it returns the vertex (v[345]). When running the same thing via Java

[WARN] KryoMessageSerializerV1d0 - Response [ResponseMessage{requestId=0b3b14e9-43a4-477d-9980-81138a8a3e28, status=ResponseStatus{code=SUCCESS, message='', attributes={}}, result=ResponseResult{data=[v[74]], meta={}}}] could not be serialized by com.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0.
[WARN] WsGremlinResponseEncoder - The result [ResponseResult{data=[v[74]], meta={}}] in the request 0b3b14e9-43a4-477d-9980-81138a8a3e28 could not be serialized and returned.
com.tinkerpop.gremlin.driver.ser.SerializationException: java.lang.UnsupportedOperationException: Properties on a vertex property is not supported
at com.tinkerpop.gremlin.driver.ser.KryoMessageSerializerV1d0.serializeResponseAsBinary(KryoMessageSerializerV1d0.java:193) 

As far as I understand the problem is that the Vertex properties has properties - but I'm not sure this is actually the case. The data I'm using is the cineasts data set found here: http://neo4j.com/developer/guide-example-data/. I get the same error using the "Jim Webber’s Doctor Who Data Set (0.05MB)", which seems to be quite straight forward.

Is Gremlin interpreting the underlying data correctly?

To reproduce (using the Dr. Who dataset):

Console:
remlin> g.V().has('actor', 'Peter Pratt').properties()
==>vp[actor->Peter Pratt]

Java:
Cluster cluster = Cluster.open();
Client client = cluster.connect();
ResultSet results = client.submit("g.V().has('actor', 'Peter Pratt')");
results.stream().forEach( (i) -> System.out.println(i.toString()) );


Any idea what I'm doing wrong? Or is this working as intended?

Thanks :)

Johannes

Stephen Mallette

unread,
Jan 8, 2015, 10:04:43 AM1/8/15
to gremli...@googlegroups.com
This is a bug.  I've extended the test suite to start testing serialization formats at a lower level than what we've been doing.  This should be fixed as part of M7 (and the current SNAPSHOT of course) given:


You can see from my remote console session that it works well with the Dr. Who dataset now:

gremlin> :remote connect tinkerpop.server conf/remote-objects.yaml
==>Connected - localhost/127.0.0.1:8182
gremlin> :> g.V().has('actor','Peter Pratt')
==>v[74]
gremlin> :> g.V().has('actor','Peter Pratt').properties()
==>vp[actor->Peter Pratt]
gremlin> result
==>result{object=vp[actor->Peter Pratt] class=com.tinkerpop.gremlin.structure.util.detached.DetachedVertexProperty}
gremlin> result[0].get(VertexProperty.class)
==>vp[actor->Peter Pratt]
gremlin> result[0].get(VertexProperty.class).value
==>Peter Pratt

Thanks for reporting this - you helped point out a big hole in our test suite.

Stephen


--
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/04c04033-42a0-481b-9c14-3b8a303a8edb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Johannes Mauerer

unread,
Jan 8, 2015, 11:05:43 AM1/8/15
to gremli...@googlegroups.com
Happy to help :)!

So should I check out the current github repository and maven install or is it better for me to wait for a new release to download? Not sure how I best go ahead and test the latest available version myself!

Thanks

Stephen Mallette

unread,
Jan 8, 2015, 11:18:16 AM1/8/15
to gremli...@googlegroups.com
It should be easy to build the project from source if you pull latest from github.  Just clone the repo and do:

mvn clean install -DskipTests

That will build the .zip files that we deploy. You will find those in gremlin-console/server directories under their respective /target/ directories.  You can unpack those as you would the actual downloads we provide OR just run the .sh files from their respective /target/*standalone* directories.  Instructions for setting up Neo4j in gremlin-server should be the same as before.

if you've never built things before (or worked with SNAPSHOTs) then you shouldn't have problems with stale dependencies.  To be safe you may want to check your .groovy/grapes directory and manually delete old tinkerpop3 jars.  


--
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.

Johannes Mauerer

unread,
Jan 8, 2015, 12:48:07 PM1/8/15
to gremli...@googlegroups.com
Hm I might be making mistakes here, but the latest version in the repository breaks everything for me. Using the classic server, with this code:

Cluster cluster = Cluster.open();
Client client = cluster.connect();
ResultSet results = client.submit("g.V(1).out('knows')");
results.stream().forEach(new Consumer<Object>() {
  public void accept(Object element) {
     System.out.println(element.toString());
   }
});

produces the following error:


18:40:29.755 [gremlin-driver-nio-1] WARN  i.n.channel.DefaultChannelPipeline - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
io.netty.handler.codec.DecoderException: com.tinkerpop.gremlin.driver.ser.SerializationException: com.esotericsoftware.kryo.KryoException: Unable to find class: vadas
Serialization trace:
properties (com.tinkerpop.gremlin.structure.util.detached.DetachedVertexProperty)
properties (com.tinkerpop.gremlin.structure.util.detached.DetachedVertex)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:99) [netty-all-4.0.23.Final.jar:4.0.23.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333) [netty-all-4.0.23.Final.jar:4.0.23.Final]

I'm using the server from gremlin-server/target/gremlin-server-3.0.0-SNAPSHOT-standalone. In Java, I'm still using 
<dependency>
      <groupId>com.tinkerpop</groupId>
       <artifactId>gremlin-driver</artifactId>
       <version>3.0.0.M6</version>
 </dependency> 

As when I ran 
mvn install:install-file -Dfile=/.../tinkerpop3/gremlin-driver/target/gremlin-driver-3.0.0-SNAPSHOT.jar -DgroupId=com.tinkerpop -DartifactId=gremlin-driver -Dversion=3.0.0.SNAPSHOT -Dpackaging=jar

And used the below dependency I get NoClassDefFoundError Errors.

<dependency>
      <groupId>com.tinkerpop</groupId>
       <artifactId>gremlin-driver</artifactId>
       <version>3.0.0.SNAPSHOT</version>
 </dependency> 

Stephen Mallette

unread,
Jan 8, 2015, 12:59:51 PM1/8/15
to gremli...@googlegroups.com
you definitely can't mix 3.0.0.M6 with the latest SNAPSHOT.  that will result in bad things.  you basically need everything on the SNAPSHOT from gremlin-core on up.  is there any chance something is still using M6 somehow.

--
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.

Johannes Mauerer

unread,
Jan 8, 2015, 1:49:26 PM1/8/15
to gremli...@googlegroups.com
Since gremlin-driver depends on gremlin-core and tinkergraph-gremlin I guess just installing the SNAPSHOT of gremlin-driver will not work. I'll try to manually add gremlin-core and tinkergraph-gremlin as dependency from SNAPSHOT jars, hopefully that'll work!

Stephen Mallette

unread,
Jan 8, 2015, 2:01:13 PM1/8/15
to gremli...@googlegroups.com
if you do: mvn clean install from the root of your clone, i don't think you need to do the manual install of the jar for each project.  

On Thu, Jan 8, 2015 at 1:49 PM, Johannes Mauerer <joha...@mauerer.info> wrote:
Since gremlin-driver depends on gremlin-core and tinkergraph-gremlin I guess just installing the SNAPSHOT of gremlin-driver will not work. I'll try to manually add gremlin-core and tinkergraph-gremlin as dependency from SNAPSHOT jars, hopefully that'll work!

--
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.

Johannes Mauerer

unread,
Jan 9, 2015, 6:51:40 AM1/9/15
to gremli...@googlegroups.com
I thought I had answered to this but seems like I never sent my answer ... here it goes:

I think I just struggled with maven dependencies, failing to include the pom.xml from gremlin-driver so it resolves the latest dependencies needed for gremlin-core automatically from the local versions. I've now brute-forced it by manually including the latest gremlin-driver and gremlin-core jars as maven dependency and adding the needed dependencies into my pom.xml. Not the prettiest solution, but didn't have the muse or time to get behind properly dealing with maven :)

Thanks for your help Stephen, very appreciated!
Reply all
Reply to author
Forward
0 new messages