NoSuchMethodError ClassTypeInformation.from

时间:2014-10-10 09:50:34

标签: java spring maven spring-boot nosuchmethoderror

我有以下依赖

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.0.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.0.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot</artifactId>
        <version>1.1.7.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <version>1.1.7.RELEASE</version>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>log4j-over-slf4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-commons</artifactId>
        <version>1.9.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-commons-core</artifactId>
        <version>1.4.1.RELEASE</version>
    </dependency>

但是我得到了以下堆栈跟踪:

Caused by: java.lang.NoSuchMethodError: org.springframework.data.util.ClassTypeInformation.from(Ljava/lang/Class;)Lorg/springframework/data/util/TypeInformation;
    at org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper.<clinit>(DefaultMongoTypeMapper.java:49)
    at org.springframework.data.mongodb.core.convert.MappingMongoConverter.<init>(MappingMongoConverter.java:110)
    at org.springframework.data.mongodb.core.MongoTemplate.getDefaultMongoConverter(MongoTemplate.java:1896)
    at org.springframework.data.mongodb.core.MongoTemplate.<init>(MongoTemplate.java:209)
    at org.springframework.data.mongodb.core.MongoTemplate.<init>(MongoTemplate.java:194)
    at org.springframework.boot.autoconfigure.mongo.MongoDataAutoConfiguration.mongoTemplate(MongoDataAutoConfiguration.java:75)
    at org.springframework.boot.autoconfigure.mongo.MongoDataAutoConfiguration$$EnhancerBySpringCGLIB$$7ba1d827.CGLIB$mongoTemplate$1(<generated>)
    at org.springframework.boot.autoconfigure.mongo.MongoDataAutoConfiguration$$EnhancerBySpringCGLIB$$7ba1d827$$FastClassBySpringCGLIB$$5c3e7e1e.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:312)
    at org.springframework.boot.autoconfigure.mongo.MongoDataAutoConfiguration$$EnhancerBySpringCGLIB$$7ba1d827.mongoTemplate(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:166)
    ... 63 more

from方法应该存在于那些版本中,所以我不知道它是如何找不到的。 什么依赖可能导致这个问题?

由于

1 个答案:

答案 0 :(得分:0)

事实上,依赖版本存在问题。我从父项目中导入了一些依赖项。

感谢@Naveen Ramawat和@Andy Wilkinson提供的评论提示。