> On 27 Feb 2015, at 14:04, Dr Josef Karthauser
> <[email protected]> wrote:
>
> Hi there,
>
> Could someone please explain why I’m getting null pointer exceptions?
>
> I’m using spring data neo4j and trying to marshal a node using
> createEntityFromStoredType. In my tests it works, but in the production code
> it fails with a null pointer… not at all sure why - very confusing!
>
> def result = ee.execute(“match (b) return b)
> result.columnAs('b').collect { def n ->
> neo4jTemplate.createEntityFromStoredType(n, null)
> }
>
> In my test code it returns a list of nodes correctly mapped, but in my
> production code I’m getting:
>
> [Assertion failed] - this argument is required; it must not be null.
> Stacktrace follows:
> Message: [Assertion failed] - this argument is required; it must not be null
> Line | Method
> ->> 30 | doCall in
> db.repositories.SearchGraphService$_getLocatedObjectsOfType_closure2
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> | 23 | getLocatedObjectsOfType in
> db.repositories.SearchGraphService$$EP5V0ixU
It definitely looks like a mapping policy issue… not sure why. When I inject a
mapping strategy in by hand it works just fine, ie.:
def policy = neo4jTemplate.getMappingPolicy(MyDomainClass)
neo4jTemplate.createEntityFromStoredType(n, policy)
The issue is that I’m obtaining objects of many different classes and the whole
point of passing in a ‘null’ in the policy field is for the mapping to be done
automatically for me.
As I said, that is working just fine in my test classes, but there’s something
weird about the wiring in my app which is preventing it from working properly.
The wiring is:
graphDatabaseFactory(GraphDatabaseFactory)
graphDatabaseService(GraphDatabaseService, "/tmp/test.db") { bean ->
bean.factoryBean = "graphDatabaseFactory"
bean.factoryMethod = "newEmbeddedDatabase"
bean.destroyMethod = "shutdown"
}
xmlns neo4j:"http://www.springframework.org/schema/data/neo4j"
neo4j.'repositories'( 'graphDatabaseService':
"graphDatabaseService", 'base-package': "db.repositories.neo4j" )
neo4j.'config'( 'graphDatabaseService': "graphDatabaseService",
'base-package': "db" )
ee(ExecutionEngine, graphDatabaseService)
neo4jTemplate(Neo4jTemplate, graphDatabaseService)
/me still scratching my head.
Thanks,
Joe
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.