我有一个无法解决的弹簧依赖问题。我使用最新版本的 spring (web mvc ...)、spring security 和 spring data。
当我用 maven 编译我的项目时,我有一个成功的构建,但是当我启动 tomcat 时,我收到以下错误:
Caused by: java.lang.IncompatibleClassChangeError: class org.springframework.core.type.classreading.ClassMetadataReadingVisitor has interface org.springframework.asm.ClassVisitor as super class
这是我的 Maven 依赖项:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>3.2.3.RELEASE</spring.version>
<spring.security.version>3.1.4.RELEASE</spring.security.version>
<spring.data.jpa.version>1.3.4.RELEASE</spring.data.jpa.version>
<spring.asm.version>3.1.4.RELEASE</spring.asm.version>
<hibernate-validator.version>4.3.1.Final</hibernate-validator.version>
<hibernate.version>4.2.3.Final</hibernate.version>
<hibernate-jpa-2.0-api.version>1.0.1.Final</hibernate-jpa-2.0-api.version>
<validation.version>1.0.0.GA</validation.version>
<postgresql.version>9.0-801.jdbc4</postgresql.version>
<hsqldb.version>1.8.0.10</hsqldb.version>
<junit.version>4.10</junit.version>
<easymock.version>3.1</easymock.version>
<slf4j.version>1.6.6</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<jackson.version>1.9.12</jackson.version>
<joda.time.version>2.2</joda.time.version>
<guava.version>14.0.1</guava.version>
<antlr.version>2.7.7</antlr.version>
<cglib.nodep.version>3.0</cglib.nodep.version>
</properties>
<dependencies>
<!-- SPRING -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- SECURITY -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${spring.security.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.security.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- JPA -->
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>${hibernate-jpa-2.0-api.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${spring.data.jpa.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
</exclusion>
<exclusion>
<artifactId>junit-dep</artifactId>
<groupId>junit</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- JACKSON -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- TESTS -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<!-- UTILS -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<!-- DATES -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda.time.version}</version>
</dependency>
<!-- LOGS -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>
你知道我该如何解决这个问题吗?
先感谢您。
编辑: 这是我的 mvn 依赖项:tree
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ schoolme ---
[INFO] com.xtapps.schoolme.server:schoolme:war:0.0.1-SNAPSHOT
[INFO] +- com.xtapps.schoolme.server:business-layer:jar:0.0.1-SNAPSHOT:compile
[INFO] | \- com.xtapps.schoolme.common:datasource-config:jar:0.0.1-SNAPSHOT:compile
[INFO] +- com.xtapps.schoolme.server:data-access-layer:jar:0.0.1-SNAPSHOT:compile
[INFO] +- org.springframework:spring-aop:jar:3.2.4.RELEASE:compile
[INFO] | \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework:spring-beans:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-context:jar:3.2.4.RELEASE:compile
[INFO] | \- org.springframework:spring-expression:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.2.4.RELEASE:compile
[INFO] | \- org.springframework:spring-web:jar:3.2.4.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-web:jar:3.1.4.RELEASE:compile
[INFO] | \- org.springframework.security:spring-security-core:jar:3.1.4.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:3.1.4.RELEASE:compile
[INFO] +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] +- org.springframework.data:spring-data-jpa:jar:1.3.4.RELEASE:compile
[INFO] | +- org.springframework.data:spring-data-commons:jar:1.5.2.RELEASE:compile
[INFO] | +- org.springframework:spring-orm:jar:3.2.4.RELEASE:compile
[INFO] | +- org.aspectj:aspectjrt:jar:1.7.2:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.1:compile
[INFO] | \- org.slf4j:jcl-over-slf4j:jar:1.7.1:runtime
[INFO] +- org.hibernate:hibernate-validator:jar:5.0.1.Final:compile
[INFO] | +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | +- org.jboss.logging:jboss-logging:jar:3.1.1.GA:compile
[INFO] | \- com.fasterxml:classmate:jar:0.8.0:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.0.1:compile
[INFO] +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.12:compile
[INFO] | \- org.codehaus.jackson:jackson-core-asl:jar:1.9.12:compile
[INFO] +- junit:junit:jar:4.10:compile
[INFO] | \- org.hamcrest:hamcrest-core:jar:1.1:compile
[INFO] +- org.springframework:spring-test:jar:3.2.4.RELEASE:test
[INFO] +- org.mockito:mockito-all:jar:1.9.0:compile
[INFO] +- commons-lang:commons-lang:jar:2.6:compile
[INFO] +- com.google.guava:guava:jar:14.0.1:compile
[INFO] +- joda-time:joda-time:jar:2.2:compile
[INFO] \- log4j:log4j:jar:1.2.17:compile
这是我的父 pom 项目:
<properties>
<spring.version>3.2.4.RELEASE</spring.version>
<spring.security.version>3.1.4.RELEASE</spring.security.version>
<spring.data.jpa.version>1.3.4.RELEASE</spring.data.jpa.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</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-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</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>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</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-web</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-test</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.security.version}</version>
</dependency>
<!-- Spring Data JPA -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${spring.data.jpa.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
这是我的 pom 项目
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<hibernate.version>4.2.3.Final</hibernate.version>
<hibernate-jpa-2.0-api.version>1.0.1.Final</hibernate-jpa-2.0-api.version>
<postgresql.version>9.0-801.jdbc4</postgresql.version>
<hsqldb.version>1.8.0.10</hsqldb.version>
<junit.version>4.10</junit.version>
<log4j.version>1.2.17</log4j.version>
<schoolme.version>0.0.1-SNAPSHOT</schoolme.version>
<jackson.version>1.9.12</jackson.version>
<joda.time.version>2.2</joda.time.version>
<guava.version>14.0.1</guava.version>
<jaxb-api.version>2.1</jaxb-api.version>
</properties>
<dependencies>
<!-- SPRING -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<!-- SECURITY -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
</dependency>
<!-- JPA - HIBERNATE -->
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>${hibernate-jpa-2.0-api.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.0.1.Final</version>
</dependency>
<!-- SERVLET API-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
<!-- JACKSON -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- TESTS -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.0</version>
</dependency>
<!-- UTILS -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<!-- DATES -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda.time.version}</version>
</dependency>
<!-- LOGS -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!--
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
-->
</dependencies>
我总是有同样的错误。感谢您的回复。