问题描述
我使用 spring-mvc 和 mongodb 作为数据库构建了一个 Web 应用程序.我使用 maven3 来构建应用程序.
I have built a web application using spring-mvc and mongodb as database. I used maven3 to build the application.
项目构建成功,但是当应用程序启动时,我在日志中收到以下错误,因为我的应用程序没有启动.这在几个月前就可以使用了.
Project builds successfully but when application starts I am getting the following error in the logs due to which my application does not start. This used to work few months ago.
Caused by: java.lang.IncompatibleClassChangeError: classorg.springframework.core.type.classreading.ClassMetadataReadingVisitor具有接口 org.springframework.asm.ClassVisitor 作为超类
如果有任何提示或需要更多信息,请告诉我.
Please let me know if any pointers or if you guys need more information.
推荐答案
当加载的类即 ClassMetadataReadingVisitor
不遵守继承的抽象类或接口的契约即 ClassVisitor.
This error happens when the loaded class i.e. ClassMetadataReadingVisitor
does not respect the contract of inherited abstract class or interface i.e. ClassVisitor
.
看起来在您的案例中加载了上述类的不同版本.
Looks like at load time different versions of the above classes are getting loaded in your case.
您的应用程序中似乎有新的 spring-core jar 和旧的 spring-asm jar.ClassMetadataReadingVisitor
类正在从 spring-core 和 ClassVisitor
从 spring-asm 加载.
Seems you have new spring-core jar and old spring-asm jar in your application. ClassMetadataReadingVisitor
class is getting loaded from spring-core and ClassVisitor
from spring-asm.
请使用 maven dependency:tree
命令查看依赖的 jar.
Please check using maven dependency:tree
command to see the dependent jars.
这篇关于IncompatibleClassChangeError: ClassMetadataReadingVisitor 具有接口 ClassVisitor 作为超类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!