0

I have followed the SDN4 migration path from SDN3 and have encountered the same issue documented here: SDN4 - Neo4j OGM - Jackson 2

A patch is referenced in the answer and mentions that it will applied to neo4j-ogm 1.1.1. I have since tried versions 1.1.1 and 1.1.2 with no success. Here is a sample of my SDN annotated entity with the JsonSubType annotation. I am using jackson-annotations 2.6.2.

@JsonTypeInfo(
        use = JsonTypeInfo.Id.NAME,
        include = JsonTypeInfo.As.WRAPPER_OBJECT)
@JsonSubTypes({
        @JsonSubTypes.Type(value = au.com.guml.domain.uml.Package.class, name = "Package"),
        @JsonSubTypes.Type(value = au.com.guml.domain.uml.Class.class, name = "Class"),
        @JsonSubTypes.Type(value = au.com.guml.domain.uml.diagram.Diagram.class, name = "Diagram")
})
@NodeEntity
public interface PackageableElement extends NamedElement {

    public Integer getSequence();

    public void setSequence(Integer sequence);

}

If I comment out the JsonSubTypes annotation my unit test works. However putting it in results in the exception as from the linked stackoverflow question.

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.neo4j.ogm.session.SessionFactory]: Factory method 'getSessionFactory' threw exception; nested exception is java.lang.ClassFormatError: Invalid annotation element type tag: 0x0
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:591)
    ... 45 more
Caused by: java.lang.ClassFormatError: Invalid annotation element type tag: 0x0

Any ideas, workarounds? It appears to me that the patch has not be applied to the releases of neo4j-ogm.

Community
  • 1
  • 1
Matthew Shaw
  • 108
  • 1
  • 7

1 Answers1

1

This should be fixed in version:

1.1.3-SNAPSHOT

Until 1.1.3 is released, you'll need to add a dependency to the snapshots repository:

   <repository>
        <id>neo4j-snapshots</id>
        <url>http://m2.neo4j.org/content/repositories/snapshots</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
Vince
  • 2,181
  • 13
  • 16