0


I have changed the version of spring security in my application from 3.2.0.M1 to 3.1.3 but I have an error when Tomcat launches my application. The first row of the exception stack is the following:

2013-04-25 11:33:12,893 [localhost-startStop-1] ERROR org.springframework.web.context.ContextLoader - org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [C:\Users\daniele\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Ice-Cream-Webapp\WEB-INF\classes\com\myprj\app\web\controller\FrontPagesController.class]; nested exception is java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class

And my pom.xml is:

 <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.company</groupId>
<artifactId>myprj-Webapp</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>

<name>myprj-Webapp</name>
<url>http://www.company.com</url>

<properties>
    <org.springframework.version>3.2.2.RELEASE</org.springframework.version>
    <org.springframework.test.version>3.2.2.RELEASE</org.springframework.test.version>
    <org.springframework.security.version>3.1.3.RELEASE</org.springframework.security.version>
    <org.springframework.security.oauth.version>1.0.2.RELEASE</org.springframework.security.oauth.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>


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

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

    <dependency>
        <groupId>jstl</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.security.oauth</groupId>
        <artifactId>spring-security-oauth2</artifactId>
        <version>${org.springframework.security.oauth.version}</version>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

    <dependency>
        <groupId>net.sourceforge.findbugs</groupId>
        <artifactId>annotations</artifactId>
        <version>1.3.2</version>
    </dependency>

    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>tomcat-servlet-api</artifactId>
        <version>7.0.34</version>
        <scope>provided</scope>
    </dependency>

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

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.10</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>org.springframework.maven.milestone</id>
        <name>Spring Maven Milestone Repository</name>
        <url>http://maven.springframework.org/milestone</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
</repositories>

<build>
    <finalName>myprj-Webapp</finalName>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

It is one day that I am working on that, I have still no idea which are the dependecies those create this conflict.
Any idea?

4

3 回答 3

2

使用 mvn dependency:tree 查找您获得的依赖项。

看起来你spring-asm jar在他们的 3.2 后导致了这个问题,所有这些都被合并到spring-core.

于 2013-04-25T11:52:59.503 回答
2

从你的 spring-security 依赖项中排除 spring asm

<exclusions>
    <exclusion>
        <groupId>org.springframework</groupId>
        <artifactId>spring-asm</artifactId>
    </exclusion>
</exclusions>
于 2013-09-11T11:51:18.653 回答
1

遇到类似的问题,通过添加解决了问题

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>${org.springframework.version}</version>
</dependency>
于 2014-09-05T20:56:33.407 回答