java.lang.VerifyError: Expecting a stackmap frame at branch target 25

首先,看下jdk中對於verifyError的解釋:
Thrown when the "verifier" detects that a class file, though well formed, contains some sort of internal inconsistency or security problem.
翻譯:當“校驗器”檢測到一個類文件雖然格式正確,但包含着一些內部不一致性或安全性問題時,拋出該錯誤。
堆棧信息:

java.lang.VerifyError: Expecting a stackmap frame at branch target 25
Exception Details:
  Location:
    controllers/TestRunner.index()V @7: ifne
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0x0000000: b802 3300 b801 fd9a 0012 1301 ff03 bd00
    0x0000010: 54b8 0202 a701 3000 bfb8 0205 b800 2f59
    0x0000020: 4e13 0230 2db8 022d 00c6 0068 2db4 0033
    0x0000030: 9900 612d b600 37aa 0000 005a 0000 0000
    0x0000040: 0000 0003 0000 001d 0000 0020 0000 002b
    0x0000050: 0000 003e a700 3d2d b600 3bc0 003d 4ba7
    0x0000060: 004b 2db6 003b c000 3d4c 2db6 003b c000
    0x0000070: 3d4b a700 5d2d b600 3bc0 003d 4d2d b600
    0x0000080: 3bc0 003d 4c2d b600 3bc0 003d 4b01 a700
    0x0000090: 82b8 0041 2dc6 0014 2db4 0044 9900 0d57
    0x00000a0: 2d10 00b6 0048 a700 9e4b 1302 272a b802
    0x00000b0: 2db8 004b 2dc6 0019 2db4 0044 9900 1257
    0x00000c0: 2d2a b600 4f2d 1001 b600 48a7 0079 4c13
    0x00000d0: 022e 2bb8 022d b800 522d c600 1e2d b400
    0x00000e0: 4499 0017 572d 2ab6 004f 2d2b b600 4f2d
    0x00000f0: 1002 b600 48a7 004f 4d13 022f 2cb8 022d
    0x0000100: 06bd 0054 5903 2a53 5904 2b53 5905 2c53
    0x0000110: b800 582d c600 222d b400 4499 001b 2d2a
    0x0000120: b600 4f2d 2bb6 004f 2d2c b600 4f2d 1003
    0x0000130: b600 48a7 0011 a700 0e3a 0601 3a05 b802
    0x0000140: 3619 06bf 013a 05b8 0236 b1            
  Exception Handler Table:
    bci [0, 313] => handler: 313
  Stackmap Table:
    same_locals_1_stack_item_frame(@23,Object[#568])
    full_frame(@84,{Top,Top,Top,Object[#43]},{})
    same_frame(@87)
    same_frame(@98)
    same_frame(@117)
    same_frame(@145)
    same_locals_1_stack_item_frame(@169,Object[#61])
    full_frame(@170,{Object[#61],Top,Top,Object[#43]},{})
    same_locals_1_stack_item_frame(@206,Object[#61])
    full_frame(@207,{Object[#61],Object[#61],Top,Object[#43]},{})
    same_locals_1_stack_item_frame(@248,Object[#61])
    full_frame(@272,{Object[#61],Object[#61],Object[#61],Object[#43]},{Object[#98]})
    same_frame(@310)
    full_frame(@313,{},{Object[#568]})
    same_frame(@324)

    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
    at java.lang.Class.getDeclaredFields(Class.java:1916)
    at jobs.Bootstrap.controllerInject(Bootstrap.java:30)
    at jobs.Bootstrap.doJob(Bootstrap.java:20)

解決:設置jvm參數,jdk1.7添加XX:-UseSplitVerifier,jdk1.8添加-noverify。這個解決辦法是我Google到的,我遇到的問題成功解決,但是我覺得這應該只是治標不治本的方法,如果有更好的解決方法,歡迎留言告知。

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