java.lang.VerifyError: class org.codehaus.jackson.map.type.ArrayType overrides final method isAbstract.()Z

核能气质少年 提交于 2019-12-11 03:01:27

问题


I am getting this error when I am deploying an application

java.lang.VerifyError: class org.codehaus.jackson.map.type.ArrayType overrides final method isAbstract.()Z
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    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.deployWARs(HostConfig.java:723)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:470)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1322)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:89)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:379)
    at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:324)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1041)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:774)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1033)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:291)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:727)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:621)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)

The interesting point is, the same application is deployed in another machines and running fine. What's wrong with this? Seen lot of questions and understood the point in the problem/java throwing. But what should I do to solve this issue for this case, is unknown.

Please help me out


回答1:


You use a jar file which contains ArrayType which tries to override a method isAbstract() which is declared final which means it cannot be overridden which makes the bytecode verifier to throw a VerifyError exceptin.

The problem is that you are mixing jars having different versions.

ArrayType inherits from org.codehaus.jackson.map.type.TypeBase which inherits from org.codehaus.jackson.type.JavaType.

JavaType is where isAbstract() is defined. In older versions it is declared as:

public final boolean isAbstract() {
    Modifier.isAbstract(_class.getModifiers());
}

Which is final as you can see which means you cannot override it. In a later version this was changed to

public boolean isAbstract() {
    Modifier.isAbstract(_class.getModifiers());
}

final has been removed later on (in a later version) which allows subclasses to override this method. You use a version of ArrayType which was built on newer versions of JavaType but your included jar is an old version when this was not allowed.

You must use the same versions from all jars and then this will work, you will not get this exception. For example copy all dependencies (jars) from the machine that does work and contains the jars with the proper versions to the other computer where you get the Exception (where you have other, older versions of your dependencies).

Or simply download the latest Jackson jars from the download page and use those everywhere.




回答2:


For me, the problem is solved by replacing Tomcat version to 7.0 instead of 6.0 I just copied the tomcat from another server to the server where I had problem and everything went fine after that. Bit weird though :-/



来源:https://stackoverflow.com/questions/25718950/java-lang-verifyerror-class-org-codehaus-jackson-map-type-arraytype-overrides-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!