简体   繁体   中英

java.lang.Exception: java.lang.VerifyError: JVMVRFY012 stack shape inconsistent;

We have just migrated from IBM Websphere 7 (Java 1.6) to Websphere 9 (Java 1.8). I'm facing issue with Long casting, code breaks while loading jsp, code snippet below (This code is written in JSP):

        long caseNum = 0L, empid = 0L;
        Long employeeId;


            employeeId = ((Long) request.getAttribute("EMPID") == null) ? 0L
                    : (Long) request.getAttribute("EMPID");
            empid = employeeId.longValue();

Below is the stack strace,

java.lang.Exception: java.lang.VerifyError: JVMVRFY012 stack shape inconsistent; class=com/ibm/_jsp/_TMTSSTaskSummary, method=_jspService(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V, pc=13805 Exception Details: Location: com/ibm/_jsp/_TMTSSTaskSummary._jspService(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V @13805: JBifnull Reason: Type top (current frame, locals[120]) is not assignable to 'java/lang/Long' (stack map, locals[120]) Current Frame: bci: @13805 flags: { } locals: { 'com/ibm/_jsp/_TMTSSTaskSummary', 'javax/servlet/http/HttpServletRequest', 'javax/servlet/http/HttpServletResponse', 'javax/servlet/jsp/PageContext', 'javax/servlet/http/HttpSession', 'javax/servlet/ServletContext', 'javax/servlet/ServletConfig', 'javax/servlet/jsp/JspWriter', 'java/lang/Object', 'javax/servlet/jsp/JspWriter', 'com/presentation/view/pageelements/SecurityAttr', 'java/lang/String', integer, 'java/lang/String', 'javax/servlet/http/HttpSession', 'java/lang/String', 'java/lang/String', integer, integer, 'j ava/util/Map', integer, 'java/lang/String', integer, 'java/lang/String', 'java/lang/String', integer, integer, integer, integer, 'java/lang/String', 'java/lang/String', 'java/lang/String', 'java/lang/String', 'java/lang/Object', 'java/lang/Object', 'java/lang/Object', 'java/lang/String', 'java/lang/Object', 'java/lang/String', 'java/lang/Object', 'java/lang/String', 'java/lang','2017-08-04 15:26:47.067','0','A','TMTSS~100: UnKnown Error','859469','518722','null','null')

Can anybody suggest any solution for this. I read about using splitverify but it works with AspectJ. Is there any other solution?

It seems to me that

  1. You are trying to typecast a null object which is raising an error or

     long caseNum = 0L, empid = 0L; Long employeeId; employeeId = (request.getAttribute("EMPID") == null) ? 0L : (Long) request.getAttribute("EMPID"); empid = employeeId.longValue(); 
  2. You are trying to cast a string or any other object to Long. In case, it is string, use Long.parseLong()

      employeeId = (request.getAttribute("EMPID") == null) ? 0L : Long.parseLong(request.getAttribute("EMPID")); empid = employeeId.longValue(); 

Also, a general advice that you don't really need to use Long employeeId to convert to long as auto-unboxing should handle that.

It seems to be java 7 compatibility issue.. In Jdk 7 you can use -XX:-UseSplitVerifier. And if you are using JDK 8 -XX:-UseSplitVerifier is deprecated and replaced with -noverify. I have added -noverify to jvm argument and it resolved my issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM