java.lang.VerifyError: Inconsistent stackmap frames at branch target 421

java.lang.VerifyError: Inconsistent stackmap frames at branch target 421

当我尝试部署 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)

下面是我用来编译代码的编译器

<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>

请查看并回复,抱歉我不是格式化专家。

经过一番努力,我找到了问题所在。在两个不同的库中,CGError 和 CGResponse 存在重复 类。所以我想编译时使用的可能与 运行 时加载的不同。无论如何解决重复 类 成功了,并解决了这个问题。

PS:如果您使用的是 Java 1.8,请不要在 -XX:-UseSplitVerifier 配置上浪费时间来解决此问题,即使您使用的是 Java 1.7 也请尝试尽可能避免使用该配置。请通过以下 URL 以更好地了解该问题:

What is a stack map frame

就我而言,这个问题与 javassist verison 有关,我在线程

中报告

此致,

对于使用 OpenJDK Java 版本的任何人,在我的例子中,这个问题的原因是我在三元语句中进行了 instanceof 检查。一旦我用适当的 if-else 语句替换它,这个错误就消失了。当我将它设置回三进制时,错误返回。我的JRE是8.0.212.03-hotspot,供参考。

我也在用Nashorn,不知道有没有关系?

我在使用 Eclipse jee 2019-12-R 时遇到这个错误。更改 Eclipse 版本修复了它。