java.lang.NoSuchMethodError:org.springframework.beans.MutablePropertyValues.add(Ljava / lang / String; Ljava / lang / Object;)with spring 4.0.5

时间:2014-08-05 15:17:54

标签: spring maven spring-mvc

我收到此错误通常会对版本产生影响,但在我的情况下,我使用的是Spring 4.0.5 希望有人能帮助我找到问题。

java.lang.NoSuchMethodError:org.springframework.beans.MutablePropertyValues.add(Ljava/lang/String;Ljava/lang/Object;)Lorg/springframework/beans/MutablePropertyValues;

这是我的调度员

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/mvc
    http://www.springframework.org/schema/mvc/spring-mvc.xsd
    http://www.springframework.org/schema/aop 
    http://www.springframework.org/schema/aop/spring-aop.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd">
<!-- Annotation -->
<context:annotation-config />

<!-- Déclaration des package de base -->
<context:component-scan base-package="com.edf.bruteweb"/>

<!-- ajout du view resolver pour afficher les jsp dans le navigateur -->
<bean
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix">
        <value>/WEB-INF/views/</value>
    </property>
    <property name="suffix">
        <value>.jsp</value>
    </property>
</bean>

<!--     Déclaration des beans --> 
    <bean id="bruteDao" class="com.edf.bruteweb.dao.BruteDAOImpl" />  
    <bean id="bruteService" class="com.edf.bruteweb.service.BruteServiceImpl" />
<mvc:resources mapping="/resources/**" location="/resources/"/> 

<mvc:annotation-driven />
</beans>
我使用的pom:

    <properties>
        <spring.version>4.0.5.RELEASE</spring.version>
        <junit.version>4.11</junit.version>
        <jdk.version>1.6</jdk.version>
    </properties>
<dependencies>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>${spring.version}</version>
            <type>jar</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${spring.version}</version>
        </dependency>
    </dependencies>

all the answer i've found says it's due to an old version

1 个答案:

答案 0 :(得分:0)

这个方法是在Spring 3.0中添加的,所以你可能在类路径中有一些3.0之前的Spring版本jar。检查你的类路径和maven的依赖关系。肯定有一些版本不匹配!