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

Spring Data Neo4j/OGM - java.lang.NoSuchMethodError: org.neo4j.ogm.session.Session.load


I have downloaded the latest version of

    <neo4j.version>3.0.7</neo4j.version>
    <spring-data-neo4j.version>4.2.0.BUILD-SNAPSHOT</spring-data-neo4j.version>
    <neo4j-ogm.version>2.1.0-SNAPSHOT</neo4j-ogm.version>

and right now my build fails with a following exception:

java.lang.NoSuchMethodError: org.neo4j.ogm.session.Session.load(Ljava/lang/Class;Ljava/lang/Object;)Ljava/lang/Object;
    at org.springframework.data.neo4j.repository.support.SimpleGraphRepository.findOne(SimpleGraphRepository.java:86)
    at org.springframework.data.neo4j.repository.support.SimpleGraphRepository.findOne(SimpleGraphRepository.java:42)
    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.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.$Proxy122.findOne(Unknown Source)

UPDATED

added the code that causes this exception:

@Repository
public interface CharacteristicRepository extends GraphRepository<Characteristic> {
....
}

characteristicRepository.findOne(id);

How to fix it ?


Solution

  • Please use 2.1.0-RC1 of the OGM with the current SDN snapshot. The RC1 of SDN has been postponed so the snapshots for both projects are a bit out of sync. The latest OGM code has subsequently moved ahead of SDN. Snapshots for both should work again after the RC1 release.