1

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class com.socketcruiter.config.SpringMongoConfig: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.data.mongodb.core.MongoTemplate org.springframework.data.mongodb.config.AbstractMongoConfiguration.mongoTemplate() throws java.lang.Exception] threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mappingMongoConverter' defined in class com.socketcruiter.config.SpringMongoConfig: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.data.mongodb.core.convert.MappingMongoConverter org.springframework.data.mongodb.config.AbstractMongoConfiguration.mappingMongoConverter() throws java.lang.Exception] threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.data.util.ClassTypeInformation.from(Ljava/lang/Class;)Lorg/springframework/data/util/ClassTypeInformation;

i have the following config

<mongo:mongo host="127.0.0.1" port="27017" />
<mongo:db-factory dbname="ssss" />

<bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate">
    <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
</bean>

and im using org.springframework.data spring-data-mongodb 1.7.1.RELEASE

1
  • 2
    nested exception is java.lang.NoSuchMethodError: org.springframework.data.util.ClassTypeInformation.from(Ljava/lang/Class;)Lorg/springframework/data/util/ClassTypeInformation; You aren't including a jar that has that class in it. Usually a version mismatch. Commented Jul 2, 2015 at 17:19

2 Answers 2

0

Check if you have the correct jar in your class path. You would need spring-data-commons-core jar, here is the latest version: http://mvnrepository.com/artifact/org.springframework.data/spring-data-commons-core/1.4.1.RELEASE

Sign up to request clarification or add additional context in comments.

1 Comment

i have the following in my pom.xml still getiting the same error what are the right versions to work? <artifactId>spring-core</artifactId> <version>4.0.1.RELEASE</version> <artifactId>spring-data-mongodb</artifactId> <version>1.7.1.RELEASE</version> <artifactId>spring-context</artifactId> <artifactId>spring-data-commons-core</artifactId> <version>1.4.1.RELEASE</version> <version>4.0.0.RELEASE</version> <artifactId>mongo-java-driver</artifactId> <version>3.0.2</version> <artifactId>spring-data-mongodb</artifactId> <version>1.7.1.RELEASE</version>
0

If the user name and password of your monogodb are empty, comment it out in the configuration file and debug it again.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.