VerifyError解决方案

项目升级到JDK7后,点击一个页面,报了如下错误,注意,是Error不是Exception哦!
Oops: VerifyError
An unexpected error occured caused by exception VerifyError: Inconsistent stackmap frames at branch target 778 Exception Details: Location: controllers/Games.list(Ldto/gm/sc/GameSearchCriteria;)V @778: ldc_w Reason: Type ‘java/lang/Object’ (current frame, locals[5]) is not assignable to ‘java/util/ArrayList’ (stack map, locals[5]) Current Frame: bci: @749 flags: { } locals: { ‘dto/gm/sc/GameSearchCriteria’, long, long_2nd, top, ‘common/utils/PageData’, ‘java/lang/Object’, ‘java/util/ArrayList’, ‘java/util/ArrayList’, integer } stack: { } Stackmap Frame: bci: @778 flags: { } locals: { ‘dto/gm/sc/GameSearchCriteria’, top, top, top, ‘common/utils/PageData’, ‘java/util/ArrayList’, ‘java/util/ArrayList’, ‘java/util/ArrayList’, integer } stack: { } Bytecode: 0000000: b80a c013 0a7d 2ab8 0a7f b807 c79a 0014 0000010: 1307 c904 bd01 4359 032a 53b8 07cb a704 (太长了这里省略)

产生Error的原因

经过查询是因为 Any tool that modifies bytecode in a version 51 classfile must be sure to update the stackmap information to be consistent with the bytecode in order to pass verification. JDK7 引入版本为51的字节码规范,使用了严格的类型检查器,任何工具修改了字节码的,都需要更新stackmap,但是jws修改了字节码,而没有更新 stackmap。

解决方案

解决方法:启动参数添加 -XX:-UseSplitVerifier

你可能感兴趣的:(java)