了解如何解决“不一致的堆栈映射图框架".例外 [英] Understanding how to resolve "Inconsistent stackmap frames" exception

查看:123
本文介绍了了解如何解决“不一致的堆栈映射图框架".例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当guice试图构造提到的类时,我在启动Web应用程序时遇到异常.

I get an exception on startup of the web application as guice is trying to construct the class mentioned.

java.lang.VerifyError: Inconsistent stackmap frames at branch target 2770 in method com.aptusi.apps.magazine.api.servlet.internal.EditorServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;Ljava/lang/String;Lcom/aptusi/persistence/runtime/framework/DboSession;)V at offset 200
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2483)
at java.lang.Class.getDeclaredConstructors(Class.java:1891)
at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:243)
at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:96)
at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:629)
at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:845)
at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:772)
at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:256)
at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:205)
at com.google.inject.internal.InjectorImpl.getBinding(InjectorImpl.java:146)
at com.google.inject.internal.InjectorImpl.getBinding(InjectorImpl.java:66)
at com.google.inject.servlet.ServletDefinition.init(ServletDefinition.java:103)
at com.google.inject.servlet.ManagedServletPipeline.init(ManagedServletPipeline.java:82)
at com.google.inject.servlet.ManagedFilterPipeline.initPipeline(ManagedFilterPipeline.java:102)
at com.google.inject.servlet.GuiceFilter.init(GuiceFilter.java:172)`

我知道-XX:-UseSplitVerifier和-noverify jvm选项,但是我不想使用,因为我想确保该项目中的所有代码至少是Java 7版.

I know about the -XX:-UseSplitVerifier and -noverify jvm options but I don't want to use as I want to ensure that all the code in this project is at least java version 7.

要做到这一点,了解我的代码中确切发生的位置会很有用,我不清楚这是200的偏移量,但是它可以与行号相关吗?

In order to do this It would be useful to understand where exactly this is occurring in my code, its not clear to me what the offset of 200 mentioned is but can it be related to a line number?

还有谁知道我可以在类路径上找到所有类的Java版本的方法,我正在使用maven,因此存在很多依赖关系,因此我正在寻找一种自动查找任何类的方法在可能已编译为低于1.7的Java版本的类路径上?

Also does anyone know of a way that I can find out the java versions of all classes on my classpath, I am using maven so there are a lot of dependencies, so I'm looking for an automated way of finding any classes on the classpath that may have been compiled to a lower java version than 1.7?

推荐答案

要查找类文件的版本,只需查看类文件的第8个字节即可.对于Java 7类,它将是51.像ASM这样的框架将为您做到这一点.

To find the version of a classfile, just look at the 8th byte of the classfile. It will be 51 for Java 7 classes. A framework like ASM will do this for you.

就错误而言,这意味着您的类文件格式错误.您是如何创建这些类的?您是否进行了字节码操作?如果是这样,则您的代码中可能有一个错误.

As far as the error goes, it means your classfile is malformed. How did you create these classes? Did you do any bytecode manipulation? If so, you probably have a bug in your code.

这篇关于了解如何解决“不一致的堆栈映射图框架".例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆