Can not deserialize instance of java.util.ArrayList out of FIELD_NAME token

5,666 views
Skip to first unread message

Clint Modien

unread,
Nov 2, 2013, 5:00:31 PM11/2/13
to ne...@googlegroups.com
Hi… I'm using neo4j 2.0 m6 and I was trying out some of the new api's when I came across what looks like a bug… 


When I execute this statement from the docs… everything returns and works fine…

{
 
"statements" : [ {
   
"statement" : "CREATE ( bike:Bike { weight: 10 } )CREATE ( frontWheel:Wheel { spokes: 3 } )CREATE ( backWheel:Wheel { spokes: 32 } )CREATE p1 = bike -[:HAS { position: 1 } ]-> frontWheel CREATE p2 = bike -[:HAS { position: 2 } ]-> backWheel RETURN bike, p1, p2",
   
"resultDataContents" : [ "row", "graph" ]
 
} ]
}

but when I reverse the order of the statements: and resultDataContents: like this:
  "statements" : [ {
    "resultDataContents" : [ "row", "graph" ],
    "statement" : "CREATE ( bike:Bike { weight: 10 } )CREATE ( frontWheel:Wheel { spokes: 3 } )CREATE ( backWheel:Wheel { spokes: 32 } )CREATE p1 = bike -[:HAS { position: 1 } ]-> frontWheel CREATE p2 = bike -[:HAS { position: 2 } ]-> backWheel RETURN bike, p1, p2"
 } ]
}

I get this error response:
{
results:
[
0]
errors:
[
1]
0:  
{
code: 30000
status: "NETWORK_ERROR"
message: "Can not deserialize instance of java.util.ArrayList out of FIELD_NAME token at [Source: org.eclipse.jetty.server.HttpConnection$Input@6e58b138{HttpChannelOverHttp@db0c21{r=1,a=DISPATCHED,uri=/db/data/transaction/commit},HttpConnection@2cf94af7{FILLING},g=HttpGenerator{s=COMMITTED},p=HttpParser{s=END,343 of 343}}; line: 3, column: 5]"
stackTrace: "org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of FIELD_NAME token at [Source: org.eclipse.jetty.server.HttpConnection$Input@6e58b138{HttpChannelOverHttp@db0c21{r=1,a=DISPATCHED,uri=/db/data/transaction/commit},HttpConnection@2cf94af7{FILLING},g=HttpGenerator{s=COMMITTED},p=HttpParser{s=END,343 of 343}}; line: 3, column: 5] at org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163) at org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:219) at org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:212) at org.codehaus.jackson.map.deser.std.CollectionDeserializer.handleNonArray(CollectionDeserializer.java:246) at org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:204) at org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:194) at org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:30) at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2704) at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1286) at org.codehaus.jackson.JsonParser.readValueAs(JsonParser.java:1337) at org.neo4j.server.rest.transactional.StatementDeserializer.readArray(StatementDeserializer.java:183) at org.neo4j.server.rest.transactional.StatementDeserializer.fetchNextOrNull(StatementDeserializer.java:131) at org.neo4j.server.rest.transactional.StatementDeserializer.fetchNextOrNull(StatementDeserializer.java:51) at org.neo4j.helpers.collection.PrefetchingIterator.hasNext(PrefetchingIterator.java:55) at org.neo4j.server.rest.transactional.TransactionHandle.executeStatements(TransactionHandle.java:245) at org.neo4j.server.rest.transactional.TransactionHandle.commit(TransactionHandle.java:190) at org.neo4j.server.rest.transactional.TransactionHandle.commit(TransactionHandle.java:110) at org.neo4j.server.rest.web.TransactionalService$2.write(TransactionalService.java:198) at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:71) at com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider.writeTo(StreamingOutputProvider.java:57) at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:306) at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1437) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349) at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339) at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699) at javax.servlet.http.HttpServlet.service(HttpServlet.java:848) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:698) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1506) at org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1477) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:211) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1096) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:432) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:175) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1030) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:136) at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:445) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:268) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:229) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.run(AbstractConnection.java:358) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:601) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:532) at java.lang.Thread.run(Thread.java:724) "
}
-
-
}




Michael Hunger

unread,
Nov 3, 2013, 1:06:16 AM11/3/13
to ne...@googlegroups.com
Yep, as it reads the request  in a streaming manner, it is quite picky about the order.

I think Jake submitted a few changes this week which makes it more resilient.

Michael

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Clint Modien

unread,
Nov 3, 2013, 4:44:42 PM11/3/13
to ne...@googlegroups.com
Hey Michael… thanks for the reply… I had a quick peak online and I didn’t see anywhere to try a nightly… do you guys make those publicly available?

Michael Hunger

unread,
Nov 3, 2013, 9:28:39 PM11/3/13
to ne...@googlegroups.com
Can't you just not reverse the order of the tokens for now ? :)

Michael

Clint Modien

unread,
Nov 3, 2013, 11:16:19 PM11/3/13
to ne...@googlegroups.com
Heh… well… I'm using javascript… and when it serializes an object to JSON… javascript does something incredibly unnatural… it will actually vary the ordering of the properties in the output… this is due to javascripts (for in) construct which doesn't garuantee consistent output of an objects properties (i.e. in the same order each time). So sometimes it works… and sometimes it doesn't work… I can write a some code to make sure I'm ordering them correctly to work around the bug… but that would imply that I know what order neo4j is expecting… so if it's at all possible… i'm very interested in downloading or building a fix

Clint Modien
548 Market St #27385
San Francisco CA 94104
c. 408.489.0750
f. 1.866.253.9401
e. cmo...@gmail.com
aim: cmodien
yim: cmodien

Tatham Oddie

unread,
Nov 4, 2013, 5:03:57 AM11/4/13
to ne...@googlegroups.com

Michael,

 

Adding to Clint’s JS issues, we have similar challenges in .NET. Because we take objects, then serialize them, the order is driven by the order in which the serializer discovers the properties. In both .NET and Mono, this is always alphabetical (but not actually guaranteed to be that way at all). That means that if we just fed an object straight into the serializer, the tokens would come out in the wrong order (r before s). It’s another annoying quirk of Neo4j not really reading or writing JSON. Maybe you could call it NeON (Neo Object Notation)? :p

 

--

Tatham Oddie

Jacob Hansson

unread,
Nov 5, 2013, 3:45:50 AM11/5/13
to ne...@googlegroups.com

Good morning guys,

I'm having a look at this this morning, it shouldn't do this. Let me get back in a few hours and I should have it resolved for you.

Jake

Sent from my phone, please excuse typos and brevity.

Jacob Hansson

unread,
Nov 5, 2013, 5:33:30 AM11/5/13
to ne...@googlegroups.com
Good news :) Went through it now, and confirmed that this has in fact been resolved, and will be part of the next release. The relevant commit is here:


The streaming endpoint should parse incoming JSON in any order, please ping us if you run into more issues like this.

Happy hacking,
Jake

Clint Modien

unread,
Nov 5, 2013, 11:53:54 AM11/5/13
to ne...@googlegroups.com
Thanks Jake… I was able to build your branch from source… I wasn't able to figure out how to package the snapshot up so that I could execute it.  

How do I create a runnable package?

Clint Modien
548 Market St #27385
San Francisco CA 94104
c. 408.489.0750
f. 1.866.253.9401
e. cmo...@gmail.com
aim: cmodien
yim: cmodien


Jacob Hansson

unread,
Nov 5, 2013, 5:22:34 PM11/5/13
to ne...@googlegroups.com
It's a bit of work to do that from scratch, since the packaged runnable includes the Neo4j manual and the admin GUI, which require special tools to build. There's documentation for how to do it in the README, see 'building everything' under 'Building' here: https://github.com/neo4j/neo4j


What platform are you running, and which edition? I can upload a built package for you to try out if you'd like when I get into work tomorrow.

/jake

Clint Modien

unread,
Nov 5, 2013, 6:07:01 PM11/5/13
to ne...@googlegroups.com
Nice… thanks… I'm on Mac… but deploying and testing on an ubuntu vps… 

I'm assuming it's the same package for both but just in case… the linux side is Ubuntu 12.04.1… and Mac is OS X 10.9… 
Reply all
Reply to author
Forward
0 new messages