在servlet预加载上获取java.lang.NoSuchMethodError

时间:2013-10-30 12:23:40

标签: java maven servlets spring-mvc weblogic

当我尝试从IntelliJ内部调试我的Spring MVC应用程序,将其部署到Weblogic 11时,我得到以下异常

  

org.springframework.beans.factory.BeanDefinitionStoreException:   从ServletContext资源解析XML文档时出现意外异常   [/WEB-INF/mvc-dispatcher-servlet.xml];嵌套异常是   java.lang.NoSuchMethodError:   org.springframework.beans.MutablePropertyValues.add(Ljava /郎/字符串; Ljava /郎/对象;)Lorg / springframework的/豆类/ MutablePropertyValues;

我已经检查过我是否在Maven配置文件(pom.xml)中为org.springframework组指定了不同的版本,但对我来说似乎没问题。这是文件:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.springapp</groupId>
<artifactId>RuleReporter</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>RuleReporter</name>

<properties>
    <spring.version>3.2.0.RELEASE</spring.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>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>

    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>${spring.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>${spring.version}</version>
    </dependency>

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${spring.version}</version>
    </dependency>
</dependencies>

<build>
    <finalName>RuleReporter</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <includes>
                    <include>**/*Tests.java</include>
                </includes>
            </configuration>
        </plugin>
    </plugins>
</build>

这可能是什么原因,我该如何解决这个问题?顺便说一句,如果我将应用程序部署到Tomcat,则不会发生此问题。

1 个答案:

答案 0 :(得分:0)

此课程包含在spring-beans

您应该添加依赖项:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
    <version>${spring.version}</version>
</dependency>