java.lang.VerifyError: Expecting a stack map frame

环境

操作系统: win7
play框架:1.2.7

场景

今天在启动项目时,发现如下错误:

Oops: VerifyError
An unexpected error occured caused by exception VerifyError: Expecting a stack map frame Exception Details:   Location:     controllers/adminManagement/Secure$Security.authentify(Ljava/lang/String;Ljava/lang/String;)Z @33: istore_3   Reason:     Error exists in the bytecode   Bytecode:     0000000: b800 7d12 782b b800 7a12 712a b800 77bb     0000010: 0010 59b7 0012 bf3a 0403 3eb8 0080 1904     0000020: bf3e b800 821d ac                         Exception Handler Table:     bci [0, 23] => handler: 23   Stackmap Table:     same_locals_1_stack_item_frame(@23,Object[#55]) 


play.exceptions.UnexpectedException: Unexpected Error
    at play.Invoker$Invocation.onException(Invoker.java:244)
    at play.Invoker$Invocation.run(Invoker.java:286)
    at Invocation.HTTP Request(Play!)
Caused by: java.lang.VerifyError: Expecting a stack map frame
Exception Details:
  Location:
    controllers/adminManagement/Secure$Security.authentify(Ljava/lang/String;Ljava/lang/String;)Z @33: istore_3
  Reason:
    Error exists in the bytecode
  Bytecode:
    0000000: b800 7d12 782b b800 7a12 712a b800 77bb
    0000010: 0010 59b7 0012 bf3a 0403 3eb8 0080 1904
    0000020: bf3e b800 821d ac                      
  Exception Handler Table:
    bci [0, 23] => handler: 23
  Stackmap Table:
    same_locals_1_stack_item_frame(@23,Object[#55])

    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
    at java.lang.Class.getDeclaredMethods(Class.java:1855)
    at play.utils.JavaWithCaching.findAllAnnotatedMethods(Java.java:528)
    at play.utils.JavaWithCaching.findAllAnnotatedMethods(Java.java:535)
    at play.utils.JavaWithCaching.findAllAnnotatedMethods(Java.java:498)
    at play.utils.Java.findAllAnnotatedMethods(Java.java:277)
    at play.mvc.ActionInvoker.handleFinallies(ActionInvoker.java:390)
    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:263)
    ... 1 more

可以很明显看到是jvm验证时出了错误:说是字节码错误:
网上的解释是因为使用了java的新特性,所以使用较高的版本进行编译时就会报这个错。

但是呢,我看不出这段代码哪里有问题。

/**
  * @Deprecated
  * 
  * @param username
  * @param password
  * @return
  */
 static boolean authentify(String username, String password){
     throw new UnsupportedOperationException();
 }

虽然不知道具体原因,问题还是要解决的。

对于java7而言,需要添加-XX:-UseSplitVerifier(已实践)。
对于java8而言,需要添加-noverify(未实践)。

对于我的项目而言,需要在启动文件中添加,即在gogoalback.launch文件中添加参数:
java.lang.VerifyError: Expecting a stack map frame_第1张图片

如果你不是play framework项目,可以在eclipse中进行设置:

java.lang.VerifyError: Expecting a stack map frame_第2张图片

总结

虽然是可以启动项目了,但是并没有找到具体哪块代码错了!

你可能感兴趣的:(Java)