java.lang.VerifyError:分支目标 421 处的堆栈映射帧不一致
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35159032/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java.lang.VerifyError: Inconsistent stackmap frames at branch target 421
提问by Shanaka Kuruwita
I get following error when I try to deploy a war file.
尝试部署 war 文件时出现以下错误。
SEVERE: WSSERVLET11: failed to parse runtime descriptor: java.lang.VerifyError: Inconsistent stackmap frames at branch target 421
Exception Details:
Location:
it/codegen/tbx/search/service/TravelBoxSearch.convertQuoteItemsEx(Ljava/lang/String;Ljava/lang/String;Ljava/util/List;)Lit/codegen/CGError; @421: getstatic
Reason:
Type 'it/codegen/CGResponse' (current frame, locals[5]) is not assignable to 'it/codegen/CGError' (stack map, locals[5])
Current Frame:
bci: @58
flags: { }
locals: { 'it/codegen/tbx/search/service/TravelBoxSearch', 'java/lang/String', 'java/lang/String', 'java/util/List', 'it/codegen/logging/TimeLogger', 'it/codegen/CGResponse', 'it/codegen/tbx/search/service/ShoppingBasket' }
stack: { 'it/codegen/tbx/search/service/ShoppingBasket' }
Stackmap Frame:
bci: @421
flags: { }
locals: { 'it/codegen/tbx/search/service/TravelBoxSearch', 'java/lang/String', 'java/lang/String', 'java/util/List', 'it/codegen/logging/TimeLogger', 'it/codegen/CGError', 'it/codegen/tbx/search/service/ShoppingBasket' }
stack: { }
Bytecode:
0x0000000: 013a 04b2 0127 9900 15bb 01a4 59b8 01a5
0x0000010: b601 a6b8 01a7 b701 a83a 04b8 0222 2cb6
0x0000020: 0223 bb07 d759 1402 1213 07d8 b707 d93a
0x0000030: 052a 2cb7 02b0 3a06 1906 c601 6b19 06b6
0x0000040: 02b1 3a07 1907 c601 452d c601 272d b902
0x0000050: 4e01 009a 011e bb01 cc59 b701 cd3a 082d
0x0000060: b902 3201 003a 0919 09b9 0233 0100 9900
0x0000070: 4a19 09b9 0234 0100 c002 353a 0a19 0ac6
0x0000080: 0036 190a b602 3ac6 002e 1908 bb00 3f59
0x0000090: b700 4019 0ab6 023a b602 a4b6 0042 190a
0x00000a0: b602 3ab6 023b b602 4cb6 0043 190a b602
0x00000b0: 3ab6 011d 57a7 ffb2 1907 b603 cfc6 0079
0x00000c0: 1907 b603 cfb9 0232 0100 3a09 1909 b902
0x00000d0: 3301 0099 0063 1909 b902 3401 00c0 02cf
0x00000e0: 3a0a 190a c600 4f19 08bb 003f 59b7 0040
0x00000f0: 190a b604 1db6 0042 190a b605 81b6 024c
0x0000100: b600 43b6 01e0 9900 2d19 08bb 003f 59b7
0x0000110: 0040 190a b604 1db6 0042 190a b605 81b6
0x0000120: 024c b600 43b6 01e1 c007 c819 0ab6 07da
0x0000130: b607 dba7 ff99 2a2b 2db6 07c7 3a09 1909
0x0000140: b602 8599 002b b200 29b8 0038 b200 3913
0x0000150: 07dc b600 3b2a 1909 1907 1906 b707 dd3a
0x0000160: 0519 0619 05b6 02ac c002 adb6 02c4 a700
0x0000170: 34b2 0029 b800 38b2 0039 1307 deb6 003b
0x0000180: 1905 1307 dfb6 027a a700 1ab2 0029 b800
0x0000190: 38b2 0039 1307 e0b6 003b 1905 1307 e1b6
0x00001a0: 027a a700 1ab2 0029 b800 38b2 0039 1303
0x00001b0: feb6 003b 1905 1307 e2b6 027a 1905 3a07
0x00001c0: b201 2799 0008 1904 b601 b619 07b0 3a0b
0x00001d0: b201 2799 0008 1904 b601 b619 0bbf
Exception Handler Table:
bci [27, 448] => handler: 462
bci [462, 464] => handler: 462
Stackmap Table:
append_frame(@27,Object[#3374])
full_frame(@103,{Object[#3339],Object[#3359],Object[#3359],Object[#3375],Object[#3374],Object[#3451],Object[#3623],Object[#3624],Object[#3478],Object[#3480]},{})
same_frame_extended(@181)
chop_frame(@184,1)
append_frame(@204,Object[#3480])
same_frame_extended(@307)
chop_frame(@310,1)
chop_frame(@366,1)
same_frame(@369)
same_frame(@395)
chop_frame(@418,1)
same_frame(@421)
same_frame(@444)
append_frame(@459,Object[#3451])
full_frame(@462,{Object[#3339],Object[#3359],Object[#3359],Object[#3375],Object[#3374]},{Object[#3344]})
full_frame(@475,{Object[#3339],Object[#3359],Object[#3359],Object[#3375],Object[#3374],Top,Top,Top,Top,Top,Top,Object[#3344]},{})
java.lang.VerifyError: Inconsistent stackmap frames at branch target 421
Exception Details:
Location:
it/codegen/tbx/search/service/TravelBoxSearch.convertQuoteItemsEx(Ljava/lang/String;Ljava/lang/String;Ljava/util/List;)Lit/codegen/CGError; @421: getstatic
Reason:
Type 'it/codegen/CGResponse' (current frame, locals[5]) is not assignable to 'it/codegen/CGError' (stack map, locals[5])
Current Frame:
bci: @58
flags: { }
locals: { 'it/codegen/tbx/search/service/TravelBoxSearch', 'java/lang/String', 'java/lang/String', 'java/util/List', 'it/codegen/logging/TimeLogger', 'it/codegen/CGResponse', 'it/codegen/tbx/search/service/ShoppingBasket' }
stack: { 'it/codegen/tbx/search/service/ShoppingBasket' }
Stackmap Frame:
bci: @421
flags: { }
locals: { 'it/codegen/tbx/search/service/TravelBoxSearch', 'java/lang/String', 'java/lang/String', 'java/util/List', 'it/codegen/logging/TimeLogger', 'it/codegen/CGError', 'it/codegen/tbx/search/service/ShoppingBasket' }
stack: { }
Bytecode:
0x0000000: 013a 04b2 0127 9900 15bb 01a4 59b8 01a5
0x0000010: b601 a6b8 01a7 b701 a83a 04b8 0222 2cb6
0x0000020: 0223 bb07 d759 1402 1213 07d8 b707 d93a
0x0000030: 052a 2cb7 02b0 3a06 1906 c601 6b19 06b6
0x0000040: 02b1 3a07 1907 c601 452d c601 272d b902
0x0000050: 4e01 009a 011e bb01 cc59 b701 cd3a 082d
0x0000060: b902 3201 003a 0919 09b9 0233 0100 9900
0x0000070: 4a19 09b9 0234 0100 c002 353a 0a19 0ac6
0x0000080: 0036 190a b602 3ac6 002e 1908 bb00 3f59
0x0000090: b700 4019 0ab6 023a b602 a4b6 0042 190a
0x00000a0: b602 3ab6 023b b602 4cb6 0043 190a b602
0x00000b0: 3ab6 011d 57a7 ffb2 1907 b603 cfc6 0079
0x00000c0: 1907 b603 cfb9 0232 0100 3a09 1909 b902
0x00000d0: 3301 0099 0063 1909 b902 3401 00c0 02cf
0x00000e0: 3a0a 190a c600 4f19 08bb 003f 59b7 0040
0x00000f0: 190a b604 1db6 0042 190a b605 81b6 024c
0x0000100: b600 43b6 01e0 9900 2d19 08bb 003f 59b7
0x0000110: 0040 190a b604 1db6 0042 190a b605 81b6
0x0000120: 024c b600 43b6 01e1 c007 c819 0ab6 07da
0x0000130: b607 dba7 ff99 2a2b 2db6 07c7 3a09 1909
0x0000140: b602 8599 002b b200 29b8 0038 b200 3913
0x0000150: 07dc b600 3b2a 1909 1907 1906 b707 dd3a
0x0000160: 0519 0619 05b6 02ac c002 adb6 02c4 a700
0x0000170: 34b2 0029 b800 38b2 0039 1307 deb6 003b
0x0000180: 1905 1307 dfb6 027a a700 1ab2 0029 b800
0x0000190: 38b2 0039 1307 e0b6 003b 1905 1307 e1b6
0x00001a0: 027a a700 1ab2 0029 b800 38b2 0039 1303
0x00001b0: feb6 003b 1905 1307 e2b6 027a 1905 3a07
0x00001c0: b201 2799 0008 1904 b601 b619 07b0 3a0b
0x00001d0: b201 2799 0008 1904 b601 b619 0bbf
Exception Handler Table:
bci [27, 448] => handler: 462
bci [462, 464] => handler: 462
Stackmap Table:
append_frame(@27,Object[#3374])
full_frame(@103,{Object[#3339],Object[#3359],Object[#3359],Object[#3375],Object[#3374],Object[#3451],Object[#3623],Object[#3624],Object[#3478],Object[#3480]},{})
same_frame_extended(@181)
chop_frame(@184,1)
append_frame(@204,Object[#3480])
same_frame_extended(@307)
chop_frame(@310,1)
chop_frame(@366,1)
same_frame(@369)
same_frame(@395)
chop_frame(@418,1)
same_frame(@421)
same_frame(@444)
append_frame(@459,Object[#3451])
full_frame(@462,{Object[#3339],Object[#3359],Object[#3359],Object[#3375],Object[#3374]},{Object[#3344]})
full_frame(@475,{Object[#3339],Object[#3359],Object[#3359],Object[#3375],Object[#3374],Top,Top,Top,Top,Top,Top,Object[#3344]},{})
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.getImplementorClass(DeploymentDescriptorParser.java:615)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:256)
at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:179)
at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:131)
at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(WSServletContainerInitializer.java:65)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5280)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
And following is thek compiler that I use to compile the code
以下是我用来编译代码的 k 编译器
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<executions>
<execution>
<id>default-testCompile</id>
<phase>${testCompile.enable}</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<encoding>ISO-8859-1</encoding>
<source>1.8</source>
<target>1.8</target>
<useIncrementalCompilation>false</useIncrementalCompilation>
<testSource>1.8</testSource>
<testTarget>1.8</testTarget>
<!--<testExcludes>-->
<!--<exclude>**/test/*.java</exclude>-->
<!--</testExcludes>-->
</configuration>
</plugin>
Please have look and reply, sorry I'm not a expert with formatting.
请查看并回复,抱歉我不是格式专家。
回答by Shanaka Kuruwita
After a much effort I found the issue. There was duplicate classes for CGError and CGResponse in two different libraries. So I guess the ones that were used in the compile time may differ to ones loaded in running time. Anyhow resolving the duplicate classes did the trick, and resolved this issue.
经过一番努力,我发现了这个问题。两个不同的库中有 CGError 和 CGResponse 的重复类。所以我猜在编译时使用的可能与在运行时加载的不同。无论如何,解决重复的类就成功了,并解决了这个问题。
PS: don't wast time on -XX:-UseSplitVerifier configuration to fix this issue if you are on Java 1.8, even if you are on Java 1.7 try to avoid using that configuration as much as possible. Please go through following URL in order get a better understanding about the issue:
PS:如果您使用的是 Java 1.8,请不要在 -XX:-UseSplitVerifier 配置上浪费时间来解决此问题,即使您使用的是 Java 1.7,也要尽量避免使用该配置。请通过以下 URL 以更好地了解该问题:
回答by Do Tat Hoan
In my case, this issue related to javassist verison and I reported in thread Error mocking Class which hold reference to SQLiteOpenHelper
在我的情况下,这个问题与 javassist 版本有关,我在线程错误模拟类中报告,其中包含对 SQLiteOpenHelper 的引用
Regards,
问候,
回答by Perry Monschau
For anyone using OpenJDK Java versions, in my case the cause of this issue was the fact that I had an instanceof check inside a ternary statement. Once I replaced it with a proper if-else statement this error went away. When I set it back to ternary the error returned. My JRE is 8.0.212.03-hotspot for reference.
对于使用 OpenJDK Java 版本的任何人,在我的情况下,此问题的原因是我在三元语句中进行了 instanceof 检查。一旦我用适当的 if-else 语句替换它,这个错误就消失了。当我将它设置回三元时,错误返回。我的 JRE 是 8.0.212.03-hotspot 供参考。
I'm also using Nashorn, I don't know if that has something to do with it?
我也在用Nashorn,不知道有没有关系?