java项目中有如下代码:

     @RequestMapping(value = "/getMxList")
     @ResponseBody
public Map<String, Object> getMxList(HttpServletRequest req, Model model) throws ManagerException {
String reportType = CommonUtil.getStrValue(req.getParameter("reportType"), "");
try (CacheContext context = new CacheContext()) {
if (reportType.equals("shop")) {
return shopItemInvoicingReport(req, model, context);
} else {
return ItemInvoicingReport(req, model, context);
}
} catch (ManagerException e) {
throw e;
} catch (Exception e) {
throw new ManagerException(e);
} finally {
String ticket = StringUtils.isEmpty(req.getParameter("tiket")) ? "" : String.valueOf(req
.getParameter("tiket"));
if (!StringUtils.isNotEmpty(ticket))
req.getSession().removeAttribute(ticket);
} }

  

  在eclipse中启动项目之后包如下错误:

Exception Details:
Location:
cn/wonhigh/retail/gms/web/controller/ItemInvoicingReportController.getMxList(Ljavax/servlet/http/HttpServletRequest;Lorg/springframework/ui/Model;)Ljava/util/Map; @81: aload_1
Reason:
Type top (current frame, locals[9]) is not assignable to 'java/lang/String' (stack map, locals[9])
Current Frame:
bci: @73
flags: { }
locals: { 'cn/wonhigh/retail/gms/web/controller/ItemInvoicingReportController', 'javax/servlet/http/HttpServletRequest', 'org/springframework/ui/Model', 'java/lang/String', 'java/lang/Throwable', 'java/lang/Throwable', 'cn/wonhigh/retail/mdm/api/util/CacheContext', top, 'java/util/Map' }
stack: { integer }
Stackmap Frame:
bci: @81
flags: { }
locals: { 'cn/wonhigh/retail/gms/web/controller/ItemInvoicingReportController', 'javax/servlet/http/HttpServletRequest', 'org/springframework/ui/Model', 'java/lang/String', 'java/lang/Throwable', 'java/lang/Throwable', 'cn/wonhigh/retail/mdm/api/util/CacheContext', top, 'java/util/Map', 'java/lang/String' }
stack: { }
Bytecode:
0000000: 1100 0457 2b12 7cb9 007e 0200 1233 b800
0000010: 844e 013a 0401 3a05 bb00 8a59 b700 8c3a
0000020: 062d 128d b600 8f99 004f 2a2b 2c19 06b6
0000030: 0093 3a08 1906 c600 0819 06b6 0097 2b12
0000040: 9ab9 007e 0200 b800 9c99 0008 1233 a700
0000050: 0e2b 129a b900 7e02 00b8 00a2 3a09 1909
0000060: b800 a69a 0010 2bb9 00a9 0100 1909 b900
0000070: ad02 0019 08b0 2a2b 2c19 06b6 00b2 3a08
0000080: 1906 c600 0819 06b6 0097 2b12 9ab9 007e
0000090: 0200 b800 9c99 0008 1233 a700 0e2b 129a
00000a0: b900 7e02 00b8 00a2 3a09 1909 b800 a69a
00000b0: 0010 2bb9 00a9 0100 1909 b900 ad02 0019
00000c0: 08b0 3a04 1906 c600 0819 06b6 0097 1904
00000d0: bf3a 0519 04c7 000a 1905 3a04 a700 1419
00000e0: 0419 05b8 037d 9900 0a19 0419 05b6 00b5
00000f0: 1904 bf3a 0419 04bf 3a04 bb00 2e59 1904
0000100: b700 bbbf 3a07 2b12 9ab9 007e 0200 b800
0000110: 9c99 0008 1233 a700 0e2b 129a b900 7e02
0000120: 00b8 00a2 3a09 1909 b800 a69a 0010 2bb9
0000130: 00a9 0100 1909 b900 ad02 0019 07bf
Exception Handler Table:
bci [33, 52] => handler: 194
bci [62, 128] => handler: 194
bci [138, 194] => handler: 194
bci [24, 209] => handler: 209
bci [18, 62] => handler: 243
bci [118, 138] => handler: 243
bci [194, 243] => handler: 243
bci [18, 62] => handler: 248
bci [118, 138] => handler: 248
bci [194, 243] => handler: 248
bci [18, 62] => handler: 260
bci [118, 138] => handler: 260
bci [194, 260] => handler: 260
Stackmap Table:
full_frame(@62,{Object[#1],Object[#127],Object[#106],Object[#88],Object[#182],Object[#182],Object[#138],Top,Object[#194]},{})
append_frame(@81,Object[#88])
same_locals_1_stack_item_frame(@92,Object[#88])
chop_frame(@115,1)
chop_frame(@118,2)
append_frame(@138,Top,Object[#194])
append_frame(@157,Object[#88])
same_locals_1_stack_item_frame(@168,Object[#88])
chop_frame(@191,1)
full_frame(@194,{Object[#1],Object[#127],Object[#106],Object[#88],Object[#182],Object[#182],Object[#138]},{Object[#182]})
chop_frame(@206,1)
same_locals_1_stack_item_frame(@209,Object[#182])
same_frame(@223)
same_frame(@240)
full_frame(@243,{Object[#1],Object[#127],Object[#106],Object[#88]},{Object[#46]})
same_locals_1_stack_item_frame(@248,Object[#80])
same_locals_1_stack_item_frame(@260,Object[#182])
full_frame(@281,{Object[#1],Object[#127],Object[#106],Object[#88],Top,Top,Top,Object[#182]},{})
same_locals_1_stack_item_frame(@292,Object[#88])
same_frame(@315) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
at org.springframework.context.support.AbstractApplicationContext.__refresh(AbstractApplicationContext.java:472)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5231)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5518)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.VerifyError: Inconsistent stackmap frames at branch target 81
Exception Details:
Location:
cn/wonhigh/retail/gms/web/controller/ItemInvoicingReportController.getMxList(Ljavax/servlet/http/HttpServletRequest;Lorg/springframework/ui/Model;)Ljava/util/Map; @81: aload_1
Reason:
Type top (current frame, locals[9]) is not assignable to 'java/lang/String' (stack map, locals[9])
Current Frame:
bci: @73
flags: { }
locals: { 'cn/wonhigh/retail/gms/web/controller/ItemInvoicingReportController', 'javax/servlet/http/HttpServletRequest', 'org/springframework/ui/Model', 'java/lang/String', 'java/lang/Throwable', 'java/lang/Throwable', 'cn/wonhigh/retail/mdm/api/util/CacheContext', top, 'java/util/Map' }
stack: { integer }
Stackmap Frame:
bci: @81
flags: { }
locals: { 'cn/wonhigh/retail/gms/web/controller/ItemInvoicingReportController', 'javax/servlet/http/HttpServletRequest', 'org/springframework/ui/Model', 'java/lan十月 21, 2015 11:26:11 上午 org.apache.catalina.core.ApplicationContext log

  

  参考资料:

    http://stackoverflow.com/questions/12774672/java-7-inconsistent-stackmap-frames-need-help-understanding-why-solution-wor

    http://stackoverflow.com/questions/7970622/java-7-jvm-verifyerror-in-eclipse

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=353467

    https://bugs.eclipse.org/bugs/show_bug.cgi?id=353467#c3

    http://stackoverflow.com/questions/8079504/akka-actors-fails-verifyerror-inconsistent-stackmap-frames-at-branch-target

    http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

  

  解决方法:

    加上VM options :  -XX:-UseSplitVerifier

    

  原因分析:

    报异常的方法内使用了Java 7的新特性:自动资源释放,类似于try(){},即在try后面跟一括号,在括号里面对一些资源赋值,try里面的代码块执行完毕之后会自动释放try后面的括号中声明的资源。

  Java 7 会使用新的Class类型校验器,新的类型校验器将老的校验器分为两步:

      1、类型推断

      2、类型校验

    新的类型校验器通过在javac编译时嵌入类型信息到bytecode中,省略了类型推断这一步,从而提升了classloader的性能。  

  Classload顺序(供参考)

  load -> verify -> prepare -> resove -> init

  

  -XX:+UseSplitVerifier

  Enables splitting of the verification process. By default, this option was enabled in the previous releases, and verification was split into two phases: type referencing (performed by the compiler) and type checking (performed by the JVM runtime). This option was deprecated in JDK 8, and verification is now split by default without a way to disable it.

    As of Java 7, compiled bytecode has to contain additional StackMapTable attributes. These help the verifier inside the JVM to check that classes are soundly constructed, at class loading time. Earlier versions of Java are more lenient, falling back on the slower verification without attributes.

Tools that modify the original compiled bytecode (ProGuard right after the compilation, AOP frameworks right before the execution,...) need to update the attributes consistently with the modified code. If they fail to do so, you'll get the error message "Inconsistent stackmap frames".

ProGuard should perform this preverification fine; I'm not aware of any problems with it. If you still see the error without applying ProGuard, the problem must lie with the DI or AOP.

java.lang.VerifyError: Inconsistent stackmap frames at branch target 81的更多相关文章

  1. java.lang.VerifyError: Inconsistent stackmap frames at branch target

    -XX:-UseSplitVerifier解决. 附带网址:http://stackoverflow.com/questions/12774672/java-7-inconsistent-stackm ...

  2. Scala 安装 Exception in thread "main" java.lang.VerifyError: Uninitialized object exists on backward branch 96

    windows下载安装完最新版本的Scala(2.12.4)后,终端如下错误 C:\Users\Administrator>scala -versionException in thread & ...

  3. nested exception is java.lang.VerifyError: Expecting a stackmap frame at bra

    Caused by: java.lang.VerifyError: Expecting a stackmap frame (2016-05-19 09:56:29) 转载▼ 标签: it 分类: Ja ...

  4. jedis:exception is java.lang.VerifyError: Bad type on operand stack

    项目中需要用到缓存,经过比较后,选择了redis,客户端使用jedis连接,也使用到了spring提供的spring-data-redis.配置正确后启动tomcat,发现如下异常: ======== ...

  5. Jedis:Exception in thread "main" java.lang.VerifyError: Bad type on operand stack

    Exception in thread "main" java.lang.VerifyError: Bad type on operand stackException Detai ...

  6. 报错:(未解决)java.lang.VerifyError: Instruction type does not match stack map

    报错背景: CDH中集成kafka的服务,解决完kafka的jar包报错之后重启,发现这个报错. 报错现象: java.lang.VerifyError: Instruction type does ...

  7. hadoop+javaWeb的开发中遇到包冲突问题(java.lang.VerifyError)

    1.HDFS + WEB 项目 报java.lang.VerifyError... 异常 抛异常: Exception in thread "main" java.lang.Ver ...

  8. java.lang.VerifyError异常

    以前遇到过java.lang.VerifyError 原因是jar包冲突 tomcat6自带jsp.jar.servlet.jar所以项目中不用引入 tomcat5不带jsp.jar.servlet. ...

  9. 9、android开发之java.lang.verifyError(转载)

    原文链接: http://www.linuxidc.com/Linux/2012-08/67289.htm 解决方案: 最近在做一个Android开发小项目的时候,遇到java.lang.verify ...

随机推荐

  1. delphi向SQL Server2005中存取图片

    SQL Server2005中,我用image类型来存取图片,首先把数据库表设置好 例如我的pic表有如下两列:时间,图片. delphi中,我用ADOQuery来连接数据库,但是数据库中有好几张表, ...

  2. ces

    1. 测试目录 1.1. 测试目录 2. 测试目录2 2.1 测试目录

  3. New Concept English Two 17 43

    $课文41  你把那个叫帽子吗? 422. 'Do you call that a hat?' I said to my wife. “你把那个叫帽子吗?”我对妻子说. 423. 'You needn ...

  4. FIS 的思想和优点

    资源表 各种性能优化算法的加载框架 依赖声明有助于组件化 资源自动合并 链接 与webpack对比

  5. js中的reduce()函数

    1. 首先看下语法如下 2 . 写了个demo如下 var fa = [1,2,3,4] function red(a, b) { console.log(arguments); return a + ...

  6. resin3.1处理utf-8格式的jsp时存在的问题

    解决建议:http://cnxiaowei.iteye.com/blog/262766 /dqz/eh_sdxm/reporter/reporter_show_reportdraw_river.jsp ...

  7. 40道Java基础常见面试题及详细答案

    最近看到网上流传着各种面试经验及面试题,往往都是一大堆技术题目贴上去,但是没有答案. 为此我业余时间整理了40道Java基础常见的面试题及详细答案,望各路大牛发现不对的地方不吝赐教,留言即可. 八种基 ...

  8. opencv之访问图像像素

    访问像素的三种方法 ①指针访问:最快 ②迭代器iterator:较慢,非常安全,指针访问可能出现越界问题 ③动态地址计算:更慢,通过at()实现.适用于访问具体某个第i行,j列的像素,而不适用遍历像素 ...

  9. koa/koa2项目搭建

    一键生成koa/koa2项目: 1. npm install -g koa-generator 2.新建项目目录 koa mytest (koa1项目) koa2 koa2test (koa2项目) ...

  10. mysql中distinct

    1.Distinct 位置 单独的distinct只能放在开头,否则报错,语法错误,与其他函数使用时候,没有位置限制如下 Select player_id,count(distinct(task_id ...