0

将 Spring WAR 文件部署3.1.0.RELEASE到 Tomcat 服务器时,会发生以下错误:

java.lang.IncompatibleClassChangeError: class org.springframework.asm.util.TraceClassVisitor has interface org.springframework.asm.ClassVisitor as super class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2820)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1150)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
    at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2006)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsStream(ContextConfig.java:1969)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:1858)
    at org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1826)
    at org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1812)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1306)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:896)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:322)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5103)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:812)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:787)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:607)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:932)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:529)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1377)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:857)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:795)
    at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1436)
    at org.apache.catalina.manager.HTMLManagerServlet.upload(HTMLManagerServlet.java:334)
    at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:211)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:187)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:572)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:851)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:278)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:636)

在本地 Tomcat 实例上从 eclipse 启动 WebApplication 可以正常工作,没有任何问题。谷歌上没有这个异常的结果,因为我不知道从哪里开始寻找错误,因为日志中没有我自己的类,我不使用org.springframework.asm.util.TraceClassVisitororg.springframework.asm.ClassVisitor项目中的任何地方。

为什么会出现这个错误?我该如何解决?

4

2 回答 2

0

根据 Java API,在以下情况下会引发IncompatibleClassChangeError

...当某些类定义发生不兼容的类更改时。当前执行的方法所依赖的某个类的定义已经改变。

如果我正确地解释了这一点,我敢说你有一些不兼容的 JAR。我会在你的应用服务器上检查你的类路径。

于 2013-01-23T15:38:04.423 回答
0

似乎这个问题是由使用不同版本的 Spring 在同一 tomcat 实例中运行的其他应用程序引起的。

于 2013-02-05T16:38:06.143 回答