java.lang.NoSuchMethodError: org.springframework.data.mongodb.core.mapping.MongoPersistentEntity.getPreferredConstructor()Lorg/springframework/data/mapping/PreferredConstructor;

Spring JIRA | Marty Pitt | 5 years ago
  1. 0

    I have a project that combines both MongoDB and JPA persistence strategies, so uses both of the associated projects. After upgrading versions, I've found series of exceptions thrown. Initially I was using: {code:xml} <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> {code} However, I'm assuming the snapshot has changed, because this is now throwing an excepition: {noformat} java.lang.NoClassDefFoundError: org/springframework/data/mapping/model/SpELAwareParameterValueProvider {noformat} I then upgraded to the following: {code:xml} <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> {code} Which rendered the following exception: {noformat} 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) … {noformat} 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 then tried the following: {code:xml} <properties> <spring.data.jpa.version>1.1.0.RC1</spring.data.jpa.version> <spring.data.mongo.version>1.1.0.BUILD-SNAPSHOT</spring.data.mongo.version> <query.dsl.version>2.3.0</query.dsl.version> </properties> {code} Which resulted in a {{NullPointerException}}, as follows: {noformat} 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) … {noformat} As it stands, there doesn't appear to be a working combination of JPA/MongoDB/Core that is usable.

    Spring JIRA | 5 years ago | Marty Pitt
    java.lang.NoSuchMethodError: org.springframework.data.mongodb.core.mapping.MongoPersistentEntity.getPreferredConstructor()Lorg/springframework/data/mapping/PreferredConstructor;
  2. 0

    I have a project that combines both MongoDB and JPA persistence strategies, so uses both of the associated projects. After upgrading versions, I've found series of exceptions thrown. Initially I was using: {code:xml} <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> {code} However, I'm assuming the snapshot has changed, because this is now throwing an excepition: {noformat} java.lang.NoClassDefFoundError: org/springframework/data/mapping/model/SpELAwareParameterValueProvider {noformat} I then upgraded to the following: {code:xml} <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> {code} Which rendered the following exception: {noformat} 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) … {noformat} 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 then tried the following: {code:xml} <properties> <spring.data.jpa.version>1.1.0.RC1</spring.data.jpa.version> <spring.data.mongo.version>1.1.0.BUILD-SNAPSHOT</spring.data.mongo.version> <query.dsl.version>2.3.0</query.dsl.version> </properties> {code} Which resulted in a {{NullPointerException}}, as follows: {noformat} 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) … {noformat} As it stands, there doesn't appear to be a working combination of JPA/MongoDB/Core that is usable.

    Spring JIRA | 5 years ago | Marty Pitt
    java.lang.NoSuchMethodError: org.springframework.data.mongodb.core.mapping.MongoPersistentEntity.getPreferredConstructor()Lorg/springframework/data/mapping/PreferredConstructor;
  3. 0

    Set mapping context issue in starting application

    GitHub | 3 years ago | bcfelix
    java.lang.NoSuchMethodError: org.springframework.data.neo4j.repository.GraphRepositoryFactoryBean.setMappingContext(Lorg/springframework/data/mapping/context/MappingContext;)V
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    spring data neo4j no such method error

    Stack Overflow | 8 months ago | kenlz
    org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.app.adhoc.neo4j.repository.UserRepository com.app.adhoc.controller.Neo4JExportController.userRepo; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.data.neo4j.repository.support.GraphRepositoryFactoryBean.setMappingContext(Lorg/springframework/data/mapping/context/MappingContext;)V
  6. 0

    Calling cassandraOperations.insertAsynchronously with a Cassandra entity, a write listener, and write options keeps resulting to the below exception. I'm using spring-data-cassandra 1.2.0.RELEASE with Spring 4.1.5.RELEASE. No other spring-data artifacts are in the project dependency. {code} [INFO] [talledLocalContainer] SEVERE: Servlet.service() for servlet [spring-rest] in context with path [/Contrast] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.springframework.data.mapping.model.BeanWrapper.getProperty(Lorg/springframework/data/mapping/PersistentProperty;Ljava/lang/Class;)Ljava/lang/Object;] with root cause [INFO] [talledLocalContainer] java.lang.NoSuchMethodError: org.springframework.data.mapping.model.BeanWrapper.getProperty(Lorg/springframework/data/mapping/PersistentProperty;Ljava/lang/Class;)Ljava/lang/Object; [INFO] [talledLocalContainer] at org.springframework.data.cassandra.convert.MappingCassandraConverter$2.doWithPersistentProperty(MappingCassandraConverter.java:244) [INFO] [talledLocalContainer] at org.springframework.data.cassandra.convert.MappingCassandraConverter$2.doWithPersistentProperty(MappingCassandraConverter.java:239) [INFO] [talledLocalContainer] at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:257) [INFO] [talledLocalContainer] at org.springframework.data.cassandra.convert.MappingCassandraConverter.writeInsertFromWrapper(MappingCassandraConverter.java:239) [INFO] [talledLocalContainer] at org.springframework.data.cassandra.convert.MappingCassandraConverter.writeInsertFromObject(MappingCassandraConverter.java:233) [INFO] [talledLocalContainer] at org.springframework.data.cassandra.convert.MappingCassandraConverter.write(MappingCassandraConverter.java:222) [INFO] [talledLocalContainer] at org.springframework.data.cassandra.core.CassandraTemplate.createInsertQuery(CassandraTemplate.java:841) [INFO] [talledLocalContainer] at org.springframework.data.cassandra.core.CassandraTemplate.doInsertAsync(CassandraTemplate.java:649) [INFO] [talledLocalContainer] at org.springframework.data.cassandra.core.CassandraTemplate.insertAsynchronously(CassandraTemplate.java:307) ... {code}

    Spring JIRA | 1 year ago | Noriaki Tatsumi
    java.lang.NoSuchMethodError: org.springframework.data.mapping.model.BeanWrapper.getProperty(Lorg/springframework/data/mapping/PersistentProperty;Ljava/lang/Class;)Ljava/lang/Object;

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. 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>()
    2. Spring Data MongoDB - Core
      MappingMongoConverter.read
      1. org.springframework.data.mongodb.core.convert.MappedConstructor.<init>(MappedConstructor.java:56)
      2. org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:212)
      3. org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:200)
      4. org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:164)
      5. org.springframework.data.mongodb.core.convert.MappingMongoConverter.read(MappingMongoConverter.java:73)
      5 frames