Spring MVC 配置文件报错:Error occured processing XML

来源:互联网 发布:打火机推荐 知乎 编辑:程序博客网 时间:2024/06/09 14:34

新建一个项目时,Spring MVC 的配置文件 dispatchServlet.xml 中
<mvc:resources location="/static/js/" mapping="static/js/**"></mvc:resources>
报错:

Error occured processing XML 'org.springframework.beans.MutablePropertyValues.get(Ljava/lang/String;)Ljava/lang/Object;'.See Error Log for more details

查资料说是引用的Spring Jar包有冲突(我引用的 Spring Jar 包的版本是此时的最新版4.3.7.RELEASE),执行命令mvn dependency:tree查看依赖树,发现activiti-spring引用的spring-orm版本与我配置的 Spring 的版本不一致。

<dependency>    <groupId>org.activiti</groupId>    <artifactId>activiti-spring</artifactId>    <version>5.22.0</version></dependency>

然后我就先去掉了 activiti 相关依赖,问题依然存在。
继续看 pom.xml 文件,与 Spring 整合的依赖还有shiro-springmybatis-spring:

<dependency>    <groupId>org.mybatis</groupId>    <artifactId>mybatis-spring</artifactId>    <version>1.2.2</version></dependency><dependency>    <groupId>org.apache.shiro</groupId>    <artifactId>shiro-spring</artifactId>    <version>1.2.2</version></dependency>

我试着把shiro-springmybatis-spring改成最新的版本,问题依旧没有解决。

<dependency>    <groupId>org.mybatis</groupId>    <artifactId>mybatis-spring</artifactId>    <version>1.3.1</version></dependency><dependency>    <groupId>org.apache.shiro</groupId>    <artifactId>shiro-spring</artifactId>    <version>1.3.2</version></dependency>

最后,我把 Spring Jar 包的版本由 4.3.7.RELEASE 改为 4.2.6.RELEASE ,问题就解决了。

错误的具体原因我没有找到,我猜可能是因为与 Spring 整合的其它框架目前还不支持 Spring 的最新版本。

附 pom.xml 配置:

<?xml version="1.0" encoding="UTF-8"?><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/xsd/maven-4.0.0.xsd">    <modelVersion>4.0.0</modelVersion>    <groupId>demo</groupId>    <artifactId>demo</artifactId>    <version>1.0-SNAPSHOT</version>    <packaging>war</packaging>    <properties>        <!-- <activiti-version>5.22.0</activiti-version> -->        <org.springframework.version>4.2.6.RELEASE</org.springframework.version>        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>        <shiro.version>1.3.2</shiro.version>    </properties>    <dependencies>        <!-- Spring 基础Jar包 : Begin -->        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-core</artifactId>            <version>${org.springframework.version}</version>            <exclusions>                <exclusion>                    <artifactId>commons-logging</artifactId>                    <groupId>commons-logging</groupId>                </exclusion>            </exclusions>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-beans</artifactId>            <version>${org.springframework.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-aop</artifactId>            <version>${org.springframework.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-context</artifactId>            <version>${org.springframework.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-context-support</artifactId>            <version>${org.springframework.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-jdbc</artifactId>            <version>${org.springframework.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-webmvc</artifactId>            <version>${org.springframework.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-tx</artifactId>            <version>${org.springframework.version}</version>        </dependency>        <dependency>            <groupId>org.springframework</groupId>            <artifactId>spring-orm</artifactId>            <version>${org.springframework.version}</version>        </dependency>        <dependency>            <groupId>org.aspectj</groupId>            <artifactId>aspectjweaver</artifactId>            <version>1.8.8</version>        </dependency>        <dependency>            <groupId>javax.servlet</groupId>            <artifactId>javax.servlet-api</artifactId>            <version>3.1.0</version>            <scope>provided</scope>        </dependency>        <dependency>            <groupId>javax.servlet</groupId>            <artifactId>jstl</artifactId>            <version>1.2</version>            <scope>runtime</scope>        </dependency>        <dependency>            <groupId>javax.servlet.jsp</groupId>            <artifactId>jsp-api</artifactId>            <version>2.2</version>            <scope>provided</scope>        </dependency>        <dependency>            <groupId>org.slf4j</groupId>            <artifactId>slf4j-log4j12</artifactId>            <version>1.7.7</version>        </dependency>        <dependency>            <groupId>com.google.guava</groupId>            <artifactId>guava</artifactId>            <version>15.0</version>        </dependency>        <dependency>            <groupId>org.mybatis</groupId>            <artifactId>mybatis</artifactId>            <version>3.4.4</version>        </dependency>        <dependency>            <groupId>org.mybatis</groupId>            <artifactId>mybatis-spring</artifactId>            <version>1.3.1</version>        </dependency>        <dependency>            <groupId>mysql</groupId>            <artifactId>mysql-connector-java</artifactId>            <version>5.1.22</version>            <scope>runtime</scope>        </dependency>        <dependency>            <groupId>org.json</groupId>            <artifactId>json</artifactId>            <version>20140107</version>        </dependency>        <dependency>            <groupId>com.fasterxml.jackson.core</groupId>            <artifactId>jackson-databind</artifactId>            <version>2.7.1</version>        </dependency>        <dependency>            <groupId>com.fasterxml.jackson.core</groupId>            <artifactId>jackson-databind</artifactId>            <version>2.7.1</version>        </dependency>        <dependency>            <groupId>com.fasterxml.jackson.core</groupId>            <artifactId>jackson-annotations</artifactId>            <version>2.7.1</version>        </dependency>        <dependency>            <groupId>com.alibaba</groupId>            <artifactId>fastjson</artifactId>            <version>1.1.28</version>        </dependency>        <dependency>            <groupId>org.codehaus.jackson</groupId>            <artifactId>jackson-mapper-asl</artifactId>            <version>1.9.4</version>        </dependency>        <dependency>            <groupId>com.alibaba</groupId>            <artifactId>druid</artifactId>            <version>1.0.7</version>        </dependency>        <dependency>            <groupId>commons-collections</groupId>            <artifactId>commons-collections</artifactId>            <version>3.2.1</version>        </dependency>        <dependency>            <groupId>org.apache.commons</groupId>            <artifactId>commons-lang3</artifactId>            <version>3.5</version>        </dependency>        <dependency>            <groupId>commons-httpclient</groupId>            <artifactId>commons-httpclient</artifactId>            <version>3.1</version>        </dependency>        <dependency>            <groupId>commons-fileupload</groupId>            <artifactId>commons-fileupload</artifactId>            <version>1.3.1</version>        </dependency>        <dependency>            <groupId>org.apache.shiro</groupId>            <artifactId>shiro-core</artifactId>            <version>${shiro.version}</version>        </dependency>        <dependency>            <groupId>org.apache.shiro</groupId>            <artifactId>shiro-web</artifactId>            <version>${shiro.version}</version>        </dependency>        <dependency>            <groupId>org.apache.shiro</groupId>            <artifactId>shiro-cas</artifactId>            <version>${shiro.version}</version>        </dependency>        <dependency>            <groupId>org.apache.shiro</groupId>            <artifactId>shiro-spring</artifactId>            <version>${shiro.version}</version>        </dependency>        <dependency>            <groupId>net.sf.ehcache</groupId>            <artifactId>ehcache-core</artifactId>            <version>2.6.6</version>        </dependency>        <!-- <dependency>            <groupId>org.activiti</groupId>            <artifactId>activiti-engine</artifactId>            <version>${activiti-version}</version>        </dependency>        <dependency>            <groupId>org.activiti</groupId>            <artifactId>activiti-spring</artifactId>            <version>${activiti-version}</version>        </dependency> -->    </dependencies>    <build>        <plugins>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-compiler-plugin</artifactId>                <version>3.3</version>                <configuration>                    <source>1.7</source>                    <target>1.7</target>                </configuration>            </plugin>            <plugin>                <groupId>org.apache.maven.plugins</groupId>                <artifactId>maven-surefire-plugin</artifactId>                <version>2.18.1</version>                <configuration>                    <skipTests>true</skipTests>                </configuration>            </plugin>            <plugin>                <groupId>org.eclipse.jetty</groupId>                <artifactId>jetty-maven-plugin</artifactId>                <version>9.4.3.v20170317</version>                <configuration>                    <!--                    The pause in seconds between sweeps of the webapp to check for                    changes and automatically hot redeploy if any are detected.                    By default this is 0, which disables hot deployment scanning.                    A number greater than 0 enables it.                    -->                    <scanIntervalSeconds>5</scanIntervalSeconds>                    <httpConnector>                        <port>8088</port>                    </httpConnector>                    <webApp>                        <contextPath>/demo</contextPath>                    </webApp>                </configuration>            </plugin>        </plugins>    </build></project>
1 0
原创粉丝点击