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. JS类型转换之valueOf和toString详解

    最近群里有人发了下面这题: 实现一个函数,运算结果可以满足如下预期结果: add(1)(2)// 3 add(1,2,3)(10)// 16 add(1)(2)(3)(4)(5)// 15 对于一个好 ...

  2. jQuery的无new创建方法

    一般我们去写一个框架,会采用什么样的设计呢?比如设计一个jQuery框架,一般我们会创建一个函数对象 function jQuery(params){ //构造函数 }jQuery.prototype ...

  3. 在JavaScript中进行文件处理,第一部分:基础

    译注:原文是<JavaScript高级程序设计>的作者Nicholas Zakas写的,本翻译纯属为自己学习而做,仅供参考.原文链接:这里 很多年前,我在一次Goole面试被问到,如何在w ...

  4. C# ,asp.net 获取当前,相对,绝对路径

    一.C#获取当前路径的方法: 1. System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName -获取模块的完整路径. 2. ...

  5. mongodb配置数据库文件夹,创建服务

    配置步骤 1.新建data文件夹,并在data下创建db及log文件夹 2.在mongodb安装目录下新增mongod.cfg文件,配置如下 systemLog:    destination: fi ...

  6. Python PIL : IOError: decoder jpeg not available

    The first thing I check when I got this error was to check if libjpeg was installed. Lets try this s ...

  7. Python selenium chrome 环境配置

    Python selenium chrome 环境配置 一.参考文章: 1. 记录一下python easy_install和pip安装地址和方法 http://heipark.iteye.com/b ...

  8. Linux内核配置---menuconfig

    1. 示例 config SGI_NEWPORT_CONSOLE tristate "SGI Newport Console support" depends on SGI_IP2 ...

  9. 对Linux内核中进程上下文和中断上下文的理解

    内核空间和用户空间是操作系统理论的基础之一,即内核功能模块运行在内核空间,而应用程序运行在用户空间.现代的CPU都具有不同的操作模式,代表不同的 级别,不同的级别具有不同的功能,在较低的级别中将禁止某 ...

  10. TimescaleDB 简单试用

    TimescaleDB 是一个对于pg进行了改造的时序数据库 安装测试使用docker 安装&&运行 docker run -d --name timescaledb -p 5432: ...