FacesContext.getCurrentInstance()引发java.lang.VerifyError:分支目标异常时堆栈图框架不一致

时间:2018-11-01 07:10:15

标签: java java-8 jsf-1.2 verifyerror facescontext

我已经检查了其他stackoverflow答案,但是它们都没有针对JSF facescontext的答案,因此我不得不提出一个问题。 我们有jdk 6,jsf 1.2和mySQL 5.5,现在我们已升级到Java 8和mySQL 5.7。为此,我将mySql-connector jar从3.1.11替换为5.1.18。但是当我启动tomcat时,它会引发如下异常:

SEVERE: Exception sending context initialized event to listener instance of class [com.sun.faces.config.ConfigureListener]
java.lang.VerifyError: Inconsistent stackmap frames at branch target 922
Exception Details:
  Location:
    web/clerk/webapp/iucs/officer/bean/OfficerScheduleBean.addOfficerSchedule()Ljava/lang/String; @922: invokestatic
  Reason:
    Type top (current frame, locals[41]) is not assignable to integer (stack map, locals[41])
  Current Frame:
    bci: @904
    flags: { }
    locals: { 'web/clerk/webapp/iucs/officer/bean/OfficerScheduleBean', 'java/lang/String', 'java/io/InputStream', 'java/util/List', 'java/io/BufferedReader', 'javax/servlet/http/HttpSession', 'web/clerk/webapp/iucs/userprofile/pojo/UserProfile', 'java/util/Map', 'java/util/List', 'web/clerk/webapp/iucs/officer/pojo/OfficerSchedule', 'java/lang/String', '[Ljava/lang/String;', integer, integer, 'java/util/Map', 'java/util/Set', integer, integer, 'web/clerk/webapp/iucs/officer/pojo/OfficerSchedule', 'java/util/Iterator', 'java/util/List', 'web/clerk/webapp/iucs/schedule/pojo/CourtType', 'web/clerk/webapp/iucs/schedule/pojo/Location', 'java/lang/String', 'java/lang/String', 'java/lang/String', 'java/lang/String', 'java/lang/String', 'web/clerk/webapp/iucs/general/pojo/County', 'java/lang/String', integer, top, 'web/clerk/webapp/iucs/general/pojo/County', 'web/clerk/webapp/iucs/officer/pojo/OfficerSchedule', integer, integer, integer, integer, integer, integer }
    stack: { 'web/clerk/webapp/iucs/general/pojo/County' }
  Stackmap Frame:
    bci: @922
    flags: { }
    locals: { 'web/clerk/webapp/iucs/officer/bean/OfficerScheduleBean', 'java/lang/String', 'java/io/InputStream', 'java/util/List', 'java/io/BufferedReader', 'javax/servlet/http/HttpSession', 'web/clerk/webapp/iucs/userprofile/pojo/UserProfile', 'java/util/Map', 'java/util/List', 'web/clerk/webapp/iucs/officer/pojo/OfficerSchedule', 'java/lang/String', '[Ljava/lang/String;', integer, integer, 'java/util/Map', 'java/util/Set', integer, integer, 'web/clerk/webapp/iucs/officer/pojo/OfficerSchedule', 'java/util/Iterator', 'java/util/List', 'web/clerk/webapp/iucs/schedule/pojo/CourtType', 'web/clerk/webapp/iucs/schedule/pojo/Location', 'java/lang/String', 'java/lang/String', 'java/lang/String', 'java/lang/String', 'java/lang/String', 'web/clerk/webapp/iucs/general/pojo/County', 'java/lang/String', integer, top, 'web/clerk/webapp/iucs/general/pojo/County', 'web/clerk/webapp/iucs/officer/pojo/OfficerSchedule', integer, integer, integer, integer, integer, integer, top, integer }
    stack: { }
  Bytecode:
    0x0000000: bb00 a559 2ab6 00a7 b600 adb8 00b2 b700
    0x0000010: b813 0720 b600 bcb6 00c0 b800 c312 fb4c
    0x0000020: 2ab6 0722 c600 112a b607 22b9 05c4 0100
    0x0000030: 0994 9a00 2a13 0725 12fb b802 ecbb 00a5
    0x0000040: 592a b600 a7b6 00ad b800 b2b7 00b8 1307.....

深入研究代码,我发现内部错误方法FacesContext.getCurrentInstance();中的代码正在错误。当我检查相应的jar时,它指向 jsf-api.jar。。现在我知道一种解决方案是在VM中添加 -noverify 参数,但是,可能是查看我的生产环境的补丁程序,我无法弄清楚根本原因是什么,可以采取什么解决方案?

1 个答案:

答案 0 :(得分:1)

找到正确的论点: 实际上,我尝试从安全模式将 webdir 添加到环境变量中,但是它也不起作用。所以我删除了它,并在tomcat的参数中添加了 -Xverify:none ,它开始起作用。

enter image description here