ClassMetadataReadingVisitor has interface ClassVisitor as super class 问题解决

本文探讨了在使用Spring框架时遇到的冲突问题,导致使用Tomcat启动失败的情况。通过分析发现,Spring-asm包与自身内部类存在命名冲突。作者通过排除依赖并重新部署的方式解决了这一问题,确保了项目的正常运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

项目POM 文件加入一个包后build没问题,Tomcat启动失败,后台报错如下。

Failed to read candidate component class ....
IncompatibleClassChangeError: class ClassMetadataReadingVisitor has interface ClassVisitor as super class

问题原因参见文章: http://www.cnblogs.com/taven/archive/2013/04/02/2994998.html
简言之就是 spring 的 类 ClassMetadataReadingVisitor 继承了 ClassVisitor 抽象类,但是在spring-asm 包中有个同名的 ClassVisitor 接口。

问题解决:mvn dependency:tree 查看包依赖

[INFO] \- org.apache.cxf:cxf-bundle:jar:2.7.11:compile
[INFO] +- org.apache.velocity:velocity:jar:1.7:compile
[INFO] +- wsdl4j:wsdl4j:jar:1.6.3:compile
[INFO] +- com.sun.xml.bind:jaxb-xjc:jar:2.1.13:compile
[INFO] +- com.sun.xml.bind:jaxb-impl:jar:2.1.13:compile
[INFO] +- org.apache.ws.xmlschema:xmlschema-core:jar:2.1.0:compile
[INFO] +- antlr:antlr:jar:2.7.7:compile
[INFO] +- org.apache.xmlbeans:xmlbeans:jar:2.6.0:compile
[INFO] +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] +- org.apache.geronimo.specs:geronimo-jaxws_2.2_spec:jar:1.1:compile
[INFO] +- org.codehaus.woodstox:woodstox-core-asl:jar:4.2.1:compile
[INFO] +- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
[INFO] +- org.eclipse.jetty:jetty-server:jar:8.1.14.v20131031:compile
[INFO] +- org.eclipse.jetty:jetty-continuation:jar:8.1.14.v20131031:compile
[INFO] +- org.eclipse.jetty:jetty-http:jar:8.1.14.v20131031:compile
[INFO] +- org.eclipse.jetty:jetty-io:jar:8.1.14.v20131031:compile
[INFO] +- org.eclipse.jetty:jetty-util:jar:8.1.14.v20131031:compile
[INFO] +- org.eclipse.jetty:jetty-security:jar:8.1.14.v20131031:compile
[INFO] +- org.apache.geronimo.specs:geronimo-servlet_3.0_spec:jar:1.0:compile
[INFO] +- org.apache.geronimo.specs:geronimo-jms_1.1_spec:jar:1.1.1:compile
[INFO] +- org.springframework:spring-jms:jar:3.0.7.RELEASE:compile
[INFO] +- aopalliance:aopalliance:jar:1.0:compile
[INFO] [color=red]+- org.springframework:spring-asm:jar:3.0.7.RELEASE:compile[/color]
[INFO] +- org.apache.httpcomponents:httpcore-nio:jar:4.2.4:compile
[INFO] +- org.apache.httpcomponents:httpcore:jar:4.2.4:compile
[INFO] +- org.apache.httpcomponents:httpasyncclient:jar:4.0-beta3:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.2.5:compile
[INFO] +- commons-codec:commons-codec:jar:1.9:compile
[INFO] +- org.apache.mina:mina-core:jar:2.0.7:compile
[INFO] +- rhino:js:jar:1.7R2:compile
[INFO] +- javax.ws.rs:javax.ws.rs-api:jar:2.0-m10:compile
[INFO] +- net.oauth.core:oauth-provider:jar:20100527:compile
[INFO] +- net.oauth.core:oauth:jar:20100527:compile
[INFO] +- net.sf.ehcache:ehcache-core:jar:2.5.1:compile
[INFO] +- org.apache.ws.security:wss4j:jar:1.6.15:compile
[INFO] +- org.apache.santuario:xmlsec:jar:1.5.6:compile
[INFO] +- org.opensaml:opensaml:jar:2.6.1:compile
[INFO] +- org.opensaml:openws:jar:1.5.1:compile
[INFO] +- org.opensaml:xmltooling:jar:1.4.1:compile
[INFO] +- joda-time:joda-time:jar:2.2:compile
[INFO] +- xalan:serializer:jar:2.7.1:runtime
[INFO] \- org.apache.neethi:neethi:jar:3.0.3:compile

可以看到对spring-asm.jar 的依赖,下面排除该依赖,重新部署, 成功运行。 over
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<version>2.7.11</version>
<exclusions>
[color=red]<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
</exclusion>[/color]
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jms</artifactId>
</exclusion>
</exclusions>
</dependency>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值