2016-10-08 8 views
1

最新のSpring Data Neo4j 4.2.0.BUILD-SNAPSHOTOGM 2.1.0-SNAPSHOTで、次のNPEでテストが失敗しました(数日前にすべて正常に機能し、コードの1行に)変更されて:春データNeo4j 4.2.0.BUILD-SNAPSHOT OGM 2.1.0-SNAPSHOT NullPointerException

java.lang.NullPointerException 
    at org.neo4j.ogm.entity.io.EntityAccessManager.getRelationalReaders(EntityAccessManager.java:355) 
    at org.neo4j.ogm.context.EntityGraphMapper.bothWayMappingRequired(EntityGraphMapper.java:893) 
    at org.neo4j.ogm.context.EntityGraphMapper.mapEntityReferences(EntityGraphMapper.java:396) 
    at org.neo4j.ogm.context.EntityGraphMapper.mapEntity(EntityGraphMapper.java:230) 
    at org.neo4j.ogm.context.EntityGraphMapper.map(EntityGraphMapper.java:134) 
    at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:83) 
    at org.neo4j.ogm.session.delegates.SaveDelegate.save(SaveDelegate.java:44) 
    at org.neo4j.ogm.session.Neo4jSession.save(Neo4jSession.java:419) 
    at sun.reflect.GeneratedMethodAccessor61.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.springframework.data.neo4j.transaction.SharedSessionCreator$SharedSessionInvocationHandler.invoke(SharedSessionCreator.java:133) 
    at com.sun.proxy.$Proxy115.save(Unknown Source) 
    at org.springframework.data.neo4j.repository.support.SimpleGraphRepository.save(SimpleGraphRepository.java:70) 
    at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:503) 
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:488) 
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) 
    at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) 
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) 
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) 
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) 
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) 
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) 
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) 
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213) 
    at com.sun.proxy.$Proxy128.save(Unknown Source) 
    at com.decisionwanted.domain.dao.decision.CharacteristicOptionDaoImpl.createOrUpdate(CharacteristicOptionDaoImpl.java:44) 
    at com.decisionwanted.domain.dao.decision.CharacteristicOptionDaoImpl.create(CharacteristicOptionDaoImpl.java:24) 
    at com.decisionwanted.domain.DecisionCharacteristicTest.testDecisionCharacteristicOptions(DecisionCharacteristicTest.java:109) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) 
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) 
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) 
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) 
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 
    at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) 
    at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) 
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) 
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:252) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:94) 
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) 
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) 
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:191) 
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) 
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) 

マイコード:

@NodeEntity 
public class Characteristic extends Authorable { 

    public final static String NODE_NAME = "Characteristic"; 

    private final static String CONTAINS = "CONTAINS"; 
    private final static String DEFINED_BY = "DEFINED_BY"; 

    private String name; 

    private String description; 

    private Type type; 

    private Mode mode; 

    private boolean sortable; 

    @Relationship(type = CONTAINS, direction = Relationship.OUTGOING) 
    private Set<CharacteristicOption> options = new HashSet<>(); 

    @Relationship(type = CONTAINS, direction = Relationship.INCOMING) 
    private CharacteristicGroup group; 

    @Relationship(type = DEFINED_BY, direction = Relationship.OUTGOING) 
    private Decision owner; 

    public Characteristic() { 
    } 

    public Characteristic(String name, String description, Type type, Mode mode, Decision owner, User author) { 
     this.name = name; 
     this.description = description; 
     this.type = type; 
     this.mode = mode; 
     this.owner = owner; 
     setAuthor(author); 
    } 

    public Characteristic(String name, String description, Type type, Mode mode, Decision owner, User author, CharacteristicGroup group) { 
     this(name, description, type, mode, owner, author); 
     this.group = group; 
    } 

    public String getName() { 
     return name; 
    } 

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

    public String getDescription() { 
     return description; 
    } 

    public void setDescription(String description) { 
     this.description = description; 
    } 

    public Type getType() { 
     return type; 
    } 

    public void setType(Type type) { 
     this.type = type; 
    } 

    public Mode getMode() { 
     return mode; 
    } 

    public void setMode(Mode mode) { 
     this.mode = mode; 
    } 

    public boolean isSortable() { 
     return sortable; 
    } 

    public void setSortable(boolean sortable) { 
     this.sortable = sortable; 
    } 

    public Set<CharacteristicOption> getOptions() { 
     return options; 
    } 

    public void setOptions(Set<CharacteristicOption> options) { 
     this.options = options; 
    } 

    public boolean addOption(CharacteristicOption option) { 
     return options.add(option); 
    } 

    public CharacteristicGroup getGroup() { 
     return group; 
    } 

    public void setGroup(CharacteristicGroup group) { 
     this.group = group; 
    } 

    public Decision getOwner() { 
     return owner; 
    } 

    public void setOwner(Decision owner) { 
     this.owner = owner; 
    } 

    public static enum Type { 

     //@formatter:off 
     BOOLEAN("Boolean"), 
     INTEGER("Integer"), 
     STRING("String"); 
     //@formatter:on 

     private final String name; 

     Type(String name) { 
      this.name = name; 
     } 

     public String getName() { 
      return name; 
     } 

    } 

    public static enum Mode { 

     //@formatter:off 
     CHECKBOX("CheckBox"), 
     SLIDER("Slider"), 
     SELECTBOX("SelectBox"), 
     RADIOGROUP("String"); 
     //@formatter:on 

     private final String name; 

     Mode(String name) { 
      this.name = name; 
     } 

     public String getName() { 
      return name; 
     } 

    } 
} 

@NodeEntity 
public class CharacteristicOption extends BaseEntity { 

    private final static String CONTAINS = "CONTAINS"; 

    private String name; 

    private String description; 

    private Object value; 

    @Relationship(type = CONTAINS, direction = Relationship.INCOMING) 
    private Characteristic characteristic; 

    public CharacteristicOption() { 
    } 

    public CharacteristicOption(String name, String description, Object value, Characteristic characteristic) { 
     this.name = name; 
     this.description = description; 
     this.value = value; 
     this.characteristic = characteristic; 
    } 

    public String getName() { 
     return name; 
    } 

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

    public String getDescription() { 
     return description; 
    } 

    public void setDescription(String description) { 
     this.description = description; 
    } 

    public Object getValue() { 
     return value; 
    } 

    public void setValue(Object value) { 
     this.value = value; 
    } 

    public Characteristic getCharacteristic() { 
     return characteristic; 
    } 

    public void setCharacteristic(Characteristic characteristic) { 
     this.characteristic = characteristic; 
    } 

} 

@Override 
public CharacteristicOption createOrUpdate(CharacteristicOption characteristicOption) { 
    auditing(characteristicOption); 

    return characteristicOptionRepository.save(characteristicOption); 
} 

この問題の理由とどのようにそれを修正することができますか?

+0

OGMとSDNの最新スナップショットを確認できますか?昨日はビルド・ブレイクがあり、そのバージョンを使用している可能性があります。最新のスナップショットを強制的に更新するだけでよいでしょう。最新バージョンのspringとneo4j mavenスナップショットreposを確認してください。それでもエラーが出たらgithubの問題を開いてください。 – digx1

+0

@ digx1あなたの答えに感謝します。 No luck ..私は同じ結果でリポジトリを更新しました。次のgithub問題を作成しました。https://github.com/neo4j/neo4j-ogm/issues/254 – alexanoid

答えて

3

あなたCharacteristicOptionクラスはフィールド宣言しています。

private Object value;

最近は2.1.0-SNAPSHOTにコミットするには、永続プロパティとしてObjectObject[]参照を除外する。その結果、OGMは単純なノード属性ではなく、関係を介してvalueプロパティをマップしようとしました。

この問題は、最新のスナップショットビルドで修正されています。

+0

ありがとうございます! – alexanoid

関連する問題