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.
有趣的是,相同的应用程序部署在另一台机器上并运行良好。这有什么错?看到了很多问题,理解了问题/java抛出的问题。但我该怎么做才能解决这个问题呢?
Please help me out
请帮我出
2 个解决方案
#1
2
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.
您使用一个包含ArrayType的jar文件,该文件试图覆盖一个方法isAbstract(),该方法被声明为final,这意味着它不能被重写,从而使字节码验证器抛出一个VerifyError异常。
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
.
从org.codehaus.jackson.map.type ArrayType继承。继承自org.codehaus.jackson.type.JavaType的TypeBase。
JavaType
is where isAbstract()
is defined. In older versions it is declared as:
JavaType是定义isAbstract()的地方。在旧版本中,它被声明为:
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.
最终在稍后的版本中被删除(在以后的版本中),它允许子类重写此方法。您使用的ArrayType版本是在JavaType的新版本上构建的,但是在不允许的情况下,包含的jar是一个旧版本。
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).
您必须使用来自所有jar的相同版本,然后这将起作用,您将不会得到这个异常。例如,从工作的机器中复制所有依赖项(jar),并将jar与适当的版本包含到另一台计算机中,在那里您可以得到异常(在那里您有其他的、旧版本的依赖项)。
Or simply download the latest Jackson jars from the download page and use those everywhere.
或者干脆从下载页面下载最新的Jackson jar文件,然后在任何地方使用。
#2
0
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 :-/
对于我来说,这个问题是通过将Tomcat版本替换为7.0而不是6.0来解决的,我只是将Tomcat从另一个服务器复制到我遇到问题的服务器上,之后一切都很好。不过有些奇怪:- /
#1
2
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.
您使用一个包含ArrayType的jar文件,该文件试图覆盖一个方法isAbstract(),该方法被声明为final,这意味着它不能被重写,从而使字节码验证器抛出一个VerifyError异常。
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
.
从org.codehaus.jackson.map.type ArrayType继承。继承自org.codehaus.jackson.type.JavaType的TypeBase。
JavaType
is where isAbstract()
is defined. In older versions it is declared as:
JavaType是定义isAbstract()的地方。在旧版本中,它被声明为:
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.
最终在稍后的版本中被删除(在以后的版本中),它允许子类重写此方法。您使用的ArrayType版本是在JavaType的新版本上构建的,但是在不允许的情况下,包含的jar是一个旧版本。
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).
您必须使用来自所有jar的相同版本,然后这将起作用,您将不会得到这个异常。例如,从工作的机器中复制所有依赖项(jar),并将jar与适当的版本包含到另一台计算机中,在那里您可以得到异常(在那里您有其他的、旧版本的依赖项)。
Or simply download the latest Jackson jars from the download page and use those everywhere.
或者干脆从下载页面下载最新的Jackson jar文件,然后在任何地方使用。
#2
0
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 :-/
对于我来说,这个问题是通过将Tomcat版本替换为7.0而不是6.0来解决的,我只是将Tomcat从另一个服务器复制到我遇到问题的服务器上,之后一切都很好。不过有些奇怪:- /