Announcement Announcement Module
Collapse
No announcement yet.
NoSuchMethodError: MongoPersistentEntity.getPreferredConstructor Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NoSuchMethodError: MongoPersistentEntity.getPreferredConstructor

    I have a project that combines both MongoDB and JPA persistence strategies, so uses both of the associated projects.

    After upgrading versions I get the following error when running a unit test:

    Code:
    java.lang.NoSuchMethodError: org.springframework.data.mongodb.core.mapping.MongoPersistentEntity.getPreferredConstructor()Lorg/springframework/data/mapping/PreferredConstructor;
    	at org.springframework.data.mongodb.core.convert.MappedConstructor.<init>(MappedConstructor.java:56)
    	at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:212)
    	at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:200)
    	at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:164)
    	at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:73)
    ..(snip)
    My versions declared in the pom are as follows:
    Code:
    	<properties>
    		<spring.data.jpa.version>1.1.0.RC1</spring.data.jpa.version>
    		<spring.data.mongo.version>1.0.1.RELEASE</spring.data.mongo.version>
    		<query.dsl.version>2.3.0</query.dsl.version>
    	</properties>
    I assume this is a conflcit between version. Previously I was using:
    Code:
    	<properties>
    		<spring.data.jpa.version> 1.1.0.BUILD-SNAPSHOT</spring.data.jpa.version>
    		<spring.data.mongo.version>1.0.0.RC1</spring.data.mongo.version>
    		<query.dsl.version>2.3.0</query.dsl.version>
    	</properties>
    Which worked.

    However, I assume that the build snapshot for JPA has changed, as I'm now getting:

    Code:
    java.lang.NoClassDefFoundError: org/springframework/data/mapping/model/SpELAwareParameterValueProvider
    Is there a working combination of the two projects currently?

  • #2
    After further investigation, it appears the conflict is in the dependency versions of spring-data-commons-core

    spring-data-jpa:1.1.0.RC1 -> spring-data-commons-core:1.3.0.BUILD-SNAPSHOT
    spring-data-mongodb:1.0.1.RELEASE -> spring-data-commons-core:1.2.1.RELEASE

    I'm no closer to resolving the issue, just sharing where the conflict appears to stem from.

    Comment


    • #3
      Unfortunately, going to spring-data-mongodb:1.1.0.BUILD-SNAPSHOT solves the problem, and introduces another.

      Given the dependencies of:
      spring-data-jpa:1.1.0.RC1
      spring-data-mongodb:1.0.1.RELEASE
      spring-data-commons-core:1.3.0.M1

      I get a null pointer error as follows:
      Code:
      java.lang.NullPointerException
      	at org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:899)
      	at org.springframework.data.mongodb.core.convert.MappingMongoConverter$MongoDbPropertyValueProvider.getPropertyValue(MappingMongoConverter.java:874)
      	at org.springframework.data.mapping.model.PersistentEntityParameterValueProvider.getParameterValue(PersistentEntityParameterValueProvider.java:77)
      	at org.springframework.data.convert.ReflectionEntityInstantiator.createInstance(ReflectionEntityInstantiator.java:70)
      	at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:226)
      	at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:206)
      	at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:170)
      	at org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:73)
      	at org.springframework.data.mongodb.core.MongoTemplate$ReadDbObjectCallback.doWith(MongoTemplate.java:1686)
      	at org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1437)
      	at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1252)
      	at org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1241)
      	at org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:467)
      	at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.findAll(SimpleMongoRepository.java:220)
      	at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.findAll(SimpleMongoRepository.java:176)
      	at org.springframework.data.mongodb.repository.support.SimpleMongoRepository.findAll(SimpleMongoRepository.java:45)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:323)
      	at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:308)
      	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
      	at $Proxy70.findAll(Unknown Source)
      	at com.mangofactory.concorde.dao.document.BetReceiptRepositoryTests.canPersistAndReadBetReceipt(BetReceiptRepositoryTests.java:40)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
      	at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
      	at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
      	at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
      	at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
      	at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
      	at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

      Comment


      • #4
        I have the same configuration and I'm getting the same exception. I don't have a work around yet.
        Dan

        Comment


        • #5
          I am getting this error too.

          Comment


          • #6
            As a follow-up, here's the JIRA task for the issue, where Oliver has provided some further feedback:

            https://jira.springsource.org/browse/DATAMONGO-403

            Comment

            Working...
            X