Search code examples
javajava-8jsf-1.2verifyerrorfacescontext

FacesContext.getCurrentInstance() throwing java.lang.VerifyError: Inconsistent stackmap frames at branch target exception


I already checked other stackoverflow answers but none of them had an answer for JSF facescontext so I had to put a question. We had jdk 6, jsf 1.2 and mySQL 5.5 and now we have upgraded to java 8 and mySQL 5.7. For that, I have replaced mySql-connector jar from 3.1.11 to 5.1.18. But when I start tomcat, it is throwing exception as below:

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.....

Digging up the code, I found what inside erroring method, FacesContext.getCurrentInstance(); code is erroring. When I checked the corresponding jar, it is pointing to jsf-api.jar. Now I know one such solution is to add -noverify argument to VM, But still, that might be a patch looking into my production environment, I can not figure out what is the root cause and what can be the solution?


Solution

  • Found the right argument: Actually I tried adding webdir to environment variable from safe mode, but it dod not work either. So I removed that and added -Xverify:none to tomcat's argument and it started working.

    enter image description here