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

    题解: 一道思路题(话说在那个时候有多少人知道左偏树) 考虑最后一个加进来的点 必然满足 (1)从它到根一直是左链上去的 (2)没有左右子树 在这些点中寻找一个最浅的 然后删除 代码: #includ ...

  2. idea里面Java文件显示一个x

    idea里面Java文件显示一个x,编译时过滤了,setting->builder->compiler->excludes

  3. [批处理]批量提取MKV资源

    最初是下了部没字幕的动漫,是720P MKV格式的,当时没注意,下完了以后才发现是没字幕的 后来去射手上找没有,百度了半天也没有 最后只能求救与已经下了这部动漫是MKV格式且是内挂字幕的人来帮忙 最后 ...

  4. 16款最受关注的智能手表 苹果iWatch领衔

    智能手表逐渐成为科技行业的新宠,而传闻中的苹果iWatch以及已经确认即将推出的三星Galaxy Gear,显然让这股热潮达到了顶峰,也预示着大牌厂商将逐渐进入该领域,推出更多成熟的产品.以下便是16 ...

  5. 20181009-7 选题 Scrum立会报告+燃尽图 06

    Scrum立会报告+燃尽图(06)选题 此作业要求参见:https://edu.cnblogs.com/campus/nenu/2018fall/homework/2196 一.小组介绍 组长:刘莹莹 ...

  6. 解决Eclipse中新创建的Maven项目不自动创建web.xml文件

    1. 通过J2EE tools 2.项目右键-properties-project facets-勾选dynamic web moudle

  7. emmc boot_config文件不存在

    /******************************************************************************* * emmc boot_config文 ...

  8. 学习ThinkPHP第一天

    今天开始学习PHP框架了,刚开始学,感觉挺兴奋的,离自己建立自己的博客又仅了一步,在linux环境下配置一定要赋予新创建的文件夹权限: sudo chmod -R 0777   filePath 这样 ...

  9. LG3781 [SDOI2017]切树游戏

    题意 题目描述 小Q是一个热爱学习的人,他经常去维基百科学习计算机科学. 就在刚才,小Q认真地学习了一系列位运算符,其中按位异或的运算符\(\oplus\)对他影响很大.按位异或的运算符是双目运算符. ...

  10. Centos下telnet的安装和配置

    Centos下telnet的安装和配置 首先为Centos配置地址(192.168.0.1/24) 一.查看本机是否有安装telnetrpm -qa | grep telnetrpm -q telne ...