Search code examples
neo4jspring-data-neo4j-4neo4j-ogm

neo4j spring data Unrecognized field "meta"


I'm starting to work with Neo4j and spring data.

I can do a get on the data base but can not make a set.

When I try to use the save method happens this error. It seems to be because of the unrecognized field by jackson. I looked for solutions but nothing worked.

Can anybody help me?

   10:52:49.481 [http-nio-8080-exec-2] INFO  o.s.d.n.config.Neo4jConfiguration - Initialising Neo4jSession
10:52:51.617 [http-nio-8080-exec-2] ERROR o.n.o.s.response.RowModelResponse - failed to parse: {"row":[1],"meta":[null]}]}
10:52:51.694 [http-nio-8080-exec-2] INFO  o.s.d.n.config.Neo4jConfiguration - Intercepted exception
May 13, 2016 10:52:56 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [DispatcherServlet] in context with path [/ProjetoExemplo] threw exception [Request processing failed; nested exception is java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "meta" (class org.neo4j.ogm.session.result.RowModelResult), not marked as ignorable (one known property: "row"])
 at [Source: {"row":[1],"meta":[null]}]}; line: 1, column: 20] (through reference chain: org.neo4j.ogm.session.result.RowModelResult["meta"])] with root cause
com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "meta" (class org.neo4j.ogm.session.result.RowModelResult), not marked as ignorable (one known property: "row"])
 at [Source: {"row":[1],"meta":[null]}]}; line: 1, column: 20] (through reference chain: org.neo4j.ogm.session.result.RowModelResult["meta"])
    at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(UnrecognizedPropertyException.java:51)
    at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(DeserializationContext.java:731)
    at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(StdDeserializer.java:915)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(BeanDeserializerBase.java:1292)
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(BeanDeserializerBase.java:1270)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:247)
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:118)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3051)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2146)
    at org.neo4j.ogm.session.response.RowModelResponse.next(RowModelResponse.java:45)
    at org.neo4j.ogm.session.response.SessionResponseHandler.updateObjects(SessionResponseHandler.java:93)
    at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:69)
    at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:43)
    at org.neo4j.ogm.session.Neo4jSession.save(Neo4jSession.java:386)

My class:

 @NodeEntity
 @JsonIgnoreProperties(ignoreUnknown = true)
 public class Teste {

@JsonProperty("id")
private Long id;

public Long getId() {
    return id;
}

private String name;

public Teste(){

}

public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

@Override
public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((id == null) ? 0 : id.hashCode());
    return result;
}

@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (getClass() != obj.getClass())
        return false;
    Teste other = (Teste) obj;
    if (id == null) {
        if (other.id != null)
            return false;
    } else if (!id.equals(other.id))
        return false;
    return true;
}

My call:

    Teste teste1 = new Teste();
    teste1.setName("TESTE");        
    testeService.save(teste1);

Solution

  • Looks like you're using Neo4j 3? If so, the version of SDN you're using is probably incompatible. Neo4j 3.0 is compatible with these:

    • Current snapshot of SDN 4.2: 4.2.0.BUILD-SNAPSHOT
    • SDN 4.1.1: 4.1.1.RELEASE with neo4j-ogm 2.0.2