java.lang.Exception:java.lang.VerifyError:JVMVRFY012堆栈形状不一致;

时间:2017-08-04 10:06:55

标签: java websphere verifyerror

我们刚刚从IBM Websphere 7(Java 1.6)迁移到Websphere 9(Java 1.8)。 我遇到了Long cast的问题,加载jsp时的代码中断,下面的代码片段(此代码是用JSP编写的):

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


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

下面是堆栈strace,

java.lang.Exception:java.lang.VerifyError:JVMVRFY012堆栈形状不一致; class = com / ibm / _jsp / _TMTSSTaskSummary,method = _jspService(Ljavax / servlet / http / HttpServletRequest; Ljavax / servlet / http / HttpServletResponse;)V,pc = 13805 例外细节:   地点:     com / ibm / _jsp / _TMTSSTaskSummary._jspService(Ljavax / servlet / http / HttpServletRequest; Ljavax / servlet / http / HttpServletResponse;)V @ 13805:JBifnull   原因:     类型top(当前帧,locals [120])不能分配给'java / lang / Long'(堆栈映射,locals [120])   当前框架:     bci:@ 13805     旗帜:{}     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',整数,整数,'java / util / Map',整数,'java / lang / String',整数,'java / lang / String','java / lang / String',整数,整数,整数,整数,'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', '空')

任何人都可以为此提出任何解决方案。 我读过有关使用splitverify的内容,但它适用于AspectJ。还有其他解决方案吗?

2 个答案:

答案 0 :(得分:2)

在我看来

  1. 您正在尝试对引发错误或

    的空对象进行类型转换
    long caseNum = 0L, empid = 0L;
    Long employeeId;
    
    
        employeeId = (request.getAttribute("EMPID") == null) ? 0L
                : (Long) request.getAttribute("EMPID");
        empid = employeeId.longValue();
    
  2. 您正在尝试将字符串或任何其他对象强制转换为Long。如果是字符串,请使用Long.parseLong()

        employeeId = (request.getAttribute("EMPID") == null) ? 0L
                : Long.parseLong(request.getAttribute("EMPID"));
        empid = employeeId.longValue();
    
  3. 另外,一般建议你不需要使用Long employeeId转换为long auto-unboxing来处理它。

答案 1 :(得分:1)

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.