Caused by: java.lang.VerifyError: Inconsistent stackmap frames at branch target 177

用的JDK7,今天Git新pull下項目Myeclipse用Tomcat7啓動時報異常:Caused by: java.lang.VerifyError: Inconsistent stackmap frames at branch target 177

Caused by: java.lang.VerifyError: Inconsistent stackmap frames at branch target 177
Exception Details:
  Location:
    com/neusoft/intf/shake/service/impl/ShakeServiceImpl.checkUserQualification(Ljava/util/Map;)Ljava/util/Map; @177: ldc
  Reason:
    Type top (current frame, locals[7]) is not assignable to 'java/lang/String' (stack map, locals[7])
  Current Frame:
    bci: @167
    flags: { }
    locals: { 'com/neusoft/intf/shake/service/impl/ShakeServiceImpl', 'java/util/Map', integer, integer, integer, integer, 'java/lang/String', top, 'java/lang/String', 'java/util/HashMap', top, integer, top, top, top, top, 'java/util/HashMap' }
    stack: { integer }
  Stackmap Frame:
    bci: @177
    flags: { }
    locals: { 'com/neusoft/intf/shake/service/impl/ShakeServiceImpl', 'java/util/Map', integer, integer, integer, integer, 'java/lang/String', 'java/lang/String', 'java/lang/String', 'java/util/Map', top, integer, top, top, top, top, 'java/util/Map' }
    stack: { }
  Bytecode:
    0000000: 2a2b b601 993d 033e 0336 0403 3605 013a
    0000010: 06bb 0054 59b7 0056 3a09 2ab4 0032 2bb9
    0000020: 019c 0200 360b 150b 9a00 c513 01a0 3a06
    0000030: 1909 1279 126f b900 7b03 0057 1909 1301
    0000040: a219 06b9 007b 0300 5719 0912 7f13 01a4
    0000050: b900 7b03 0057 1909 1301 a603 b801 a8b9
    0000060: 007b 0300 5719 0913 01ab 03b8 01ad b900
    0000070: 7b03 0057 1909 3a10 2ab4 0038 1906 2b12
    0000080: 57b9 0059 0200 b600 5fb9 0073 0300 3a08
    0000090: 1909 1301 ab1d b801 adb9 007b 0300 5713
    00000a0: 01b2 1906 b601 1a99 000a 1271 3a07 a700
    00000b0: 0712 6f3a 0719 0912 7919 07b9 007b 0300
    00000c0: 5719 0913 01a2 1906 b900 7b03 0057 1909
    00000d0: 127f 1908 b900 7b03 0057 1909 1301 a615
    00000e0: 05b8 01a8 b900 7b03 0057 1910 b0bb 0054
    00000f0: 59b7 0056 3a0d bb00 5459 b700 563a 0e19
    0000100: 0d13 01b4 1301 b6b9 007b 0300 572a b400
    0000110: 4c19 0db9 01b8 0200 3a0e 190e 1301 bdb9
    0000120: 0059 0200 b600 5f3a 0c13 01bf 190c b601
    0000130: 1a99 00d1 1301 c13a 062a b400 3819 062b
    0000140: 1257 b900 5902 00b6 005f b900 7303 003a
    0000150: 0812 6f3a 0719 0912 7919 07b9 007b 0300
    0000160: 5719 0913 01a2 1906 b900 7b03 0057 1909
    0000170: 127f 1908 b900 7b03 0057 1909 1301 a603
    0000180: b801 a8b9 007b 0300 5719 093a 102a b400
    0000190: 3819 062b 1257 b900 5902 00b6 005f b900
    00001a0: 7303 003a 0819 0913 01ab 1db8 01ad b900
    00001b0: 7b03 0057 1301 b219 06b6 011a 9900 0a12
    00001c0: 713a 07a7 0007 126f 3a07 1909 1279 1907
    00001d0: b900 7b03 0057 1909 1301 a219 06b9 007b
    00001e0: 0300 5719 0912 7f19 08b9 007b 0300 5719
    00001f0: 0913 01a6 1505 b801 a8b9 007b 0300 5719
    0000200: 10b0 2a2b b601 c33a 0a19 0a13 01a6 b900
    0000210: 5902 00c0 0113 b601 c636 0519 0a13 01c9
    0000220: b900 5902 00c0 0113 b601 c69e 0007 04a7
    0000230: 0004 0336 041c 9900 1015 049a 000b 1301
    0000240: cb3a 06a7 0046 1505 9e00 392a 2bb6 01cd
    0000250: 3e1d 9900 0a12 6f3a 06a7 0030 1301 d02b
    0000260: 1301 0ab9 0059 0200 b600 5fb6 011a 9900
    0000270: 0b13 01d2 3a06 a700 1313 01d4 3a06 a700
    0000280: 0b03 3605 1301 d63a 06b2 0021 1301 d8b9
    0000290: 016a 0200 a701 253a 0b12 713a 06b2 0021
    00002a0: bb01 3059 1301 dab7 0132 190b b601 71b6
    00002b0: 0135 1301 74b6 0135 190b b601 76b6 017a
    00002c0: b601 39b9 017d 0200 190b b600 832a b400
    00002d0: 3819 062b 1257 b900 5902 00b6 005f b900
    00002e0: 7303 003a 0819 0913 01ab 1db8 01ad b900
    00002f0: 7b03 0057 1301 b219 06b6 011a 9900 0a12
    0000300: 713a 07a7 0007 126f 3a07 1909 1279 1907
    0000310: b900 7b03 0057 1909 1301 a219 06b9 007b
    0000320: 0300 5719 0912 7f19 08b9 007b 0300 5719
    0000330: 0913 01a6 1505 b801 a8b9 007b 0300 57a7
    0000340: 00ec 3a0f 2ab4 0038 1906 2b12 57b9 0059
    0000350: 0200 b600 5fb9 0073 0300 3a08 1909 1301
    0000360: ab1d b801 adb9 007b 0300 5713 01b2 1906
    0000370: b601 1a99 000a 1271 3a07 a700 0712 6f3a
    0000380: 0719 0912 7919 07b9 007b 0300 5719 0913
    0000390: 01a2 1906 b900 7b03 0057 1909 127f 1908
    00003a0: b900 7b03 0057 1909 1301 a615 05b8 01a8
    00003b0: b900 7b03 0057 190f bf2a b400 3819 062b
    00003c0: 1257 b900 5902 00b6 005f b900 7303 003a
    00003d0: 0819 0913 01ab 1db8 01ad b900 7b03 0057
    00003e0: 1301 b219 06b6 011a 9900 0a12 713a 07a7
    00003f0: 0007 126f 3a07 1909 1279 1907 b900 7b03
    0000400: 0057 1909 1301 a219 06b9 007b 0300 5719
    0000410: 0912 7f19 08b9 007b 0300 5719 0913 01a6
    0000420: 1505 b801 a8b9 007b 0300 5719 09b0     
  Exception Handler Table:
    bci [26, 120] => handler: 663
    bci [237, 397] => handler: 663
    bci [514, 660] => handler: 663
    bci [26, 120] => handler: 834
    bci [237, 397] => handler: 834
    bci [514, 717] => handler: 834
  Stackmap Table:
    full_frame(@177,{Object[#1],Object[#90],Integer,Integer,Integer,Integer,Object[#148],Object[#148],Object[#148],Object[#90],Top,Integer,Top,Top,Top,Top,Object[#90]},{})
    same_frame(@181)
    full_frame(@237,{Object[#1],Object[#90],Integer,Integer,Integer,Integer,Object[#148],Top,Top,Object[#90],Top,Integer},{})
    full_frame(@454,{Object[#1],O
bject[#90],Integer,Integer,Integer,Integer,Object[#148],Object[#148],Object[#148],Object[#90],Top,Integer,Object[#148],Object[#90],Object[#90],Top,Object[#90]},{})
    same_frame(@458)
    full_frame(@514,{Object[#1],Object[#90],Integer,Integer,Integer,Integer,Object[#148],Top,Top,Object[#90],Top,Integer,Object[#148],Object[#90],Object[#90]},{})
    full_frame(@562,{Object[#1],Object[#90],Integer,Integer,Integer,Integer,Object[#148],Top,Top,Object[#90],Object[#90],Integer,Object[#148],Object[#90],Object[#90]},{})
    same_locals_1_stack_item_frame(@563,Integer)
    same_frame(@582)
    same_frame(@604)
    same_frame(@633)
    same_frame(@638)
    same_frame(@641)
    same_frame(@649)
    full_frame(@663,
	... 

網上查詢了一下 在樹上唱歌寫的:https://www.cnblogs.com/zhangcybb/p/4897417.html

操作步驟:MyEclipse開發窗口->Window->Preferences->java->Installed JREs->單擊選中JDK7->單擊右側Edit...->在Default VM Arguments處追加上VM options :  -XX:-UseSplitVerifier(若是原來有值追加前加一個空格)

解決方法:

    加上VM options :  -XX:-UseSplitVerifier

解決完成。

網上寫的不完全對,但是這種方法解決了我的問題,研究比較深的夥伴們有什麼新的見解可以在下面評論,一起進步,謝謝。

參數資料:

    http://stackoverflow.com/questions/12774672/java-7-inconsistent-stackmap-frames-need-help-understanding-why-solution-wor

    http://stackoverflow.com/questions/7970622/java-7-jvm-verifyerror-in-eclipse

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=353467

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=353467#c3

    http://stackoverflow.com/questions/8079504/akka-actors-fails-verifyerror-inconsistent-stackmap-frames-at-branch-target

    http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

原因分析:
    報異常的方法內使用了Java 7的新特性:自動資源釋放,類似於try(){},即在try後面跟一括號,在括號裏面對一些資源賦值,try裏面的代碼塊執行完畢之後會自動釋放try後面的括號中聲明的資源。
  Java 7 會使用新的Class類型校驗器,新的類型校驗器將老的校驗器分爲兩步:
      1、類型推斷
      2、類型校驗
    新的類型校驗器通過在javac編譯時嵌入類型信息到bytecode中,省略了類型推斷這一步,從而提升了classloader的性能。  
  Classload順序(供參考)
       load -> verify -> prepare -> resove -> init
  
  -XX:+UseSplitVerifier
  Enables splitting of the verification process. By default, this option was enabled in the previous releases, and verification was split into two phases: type referencing (performed by the compiler) and type checking (performed by the JVM runtime). This option was deprecated in JDK 8, and verification is now split by default without a way to disable it.
 
    As of Java 7, compiled bytecode has to contain additional StackMapTable attributes. These help the verifier inside the JVM to check that classes are soundly constructed, at class loading time. Earlier versions of Java are more lenient, falling back on the slower verification without attributes.
Tools that modify the original compiled bytecode (ProGuard right after the compilation, AOP frameworks right before the execution,...) need to update the attributes consistently with the modified code. If they fail to do so, you'll get the error message "Inconsistent stackmap frames".
ProGuard should perform this preverification fine; I'm not aware of any problems with it. If you still see the error without applying ProGuard, the problem must lie with the DI or AOP.

網上寫的不完全對,但是這種方法解決了我的問題,研究比較深的夥伴們有什麼新的見解可以在下面評論,一起進步,謝謝。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章