- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
成功编译项目并使用 Maven 构建。这是我的第一个 Maven 项目。但我不知道为什么会出现以下错误。
在 tomcat 上部署 war 并点击我的 url 并在我的浏览器中显示以下错误。
java.lang.VerifyError: Expecting a stackmap frame at branch target 72
Exception Details:
Location:
com/ebetinc/frontend/presentation/components/Login.isToteAvailable(Ljava/lang/String;Lcom/ebetinc/frontend/dao/DatabaseDao;)Z @46: lookupswitch
Reason:
Expected stackmap frame at this location.
Bytecode:
0000000: 043d 2bb9 03a4 0100 4e2a c601 1c13 03a6
0000010: 2ab8 03aa 9900 0803 3da7 010d 2db8 03ad
0000020: 9900 692a 3a04 0236 0519 04b6 03b1 ab00
0000030: 0000 003a 0000 0002 0000 0626 0000 002c
0000040: 0000 0644 0000 001a 0019 0413 03b3 b603
0000050: b599 0017 0336 05a7 0011 1904 1303 b7b6
0000060: 03b5 9900 0604 3605 1505 ab00 0000 001c
0000070: 0000 0002 0000 0000 0000 001a 0000 0001
0000080: 0000 001a 033d a700 a02d b803 ba99 0099
0000090: 2a3a 0402 3605 1904 b603 b1ab 0000 006a
00000a0: 0000 0004 0000 af34 0000 0029 0000 af4c
00000b0: 0000 003a 0000 af4d 0000 004b 0015 51cb
00000c0: 0000 005c 1904 1303 bcb6 03b5 9900 3903
00000d0: 3605 a700 3319 0413 03be b603 b599 0028
00000e0: 0436 05a7 0022 1904 1303 c0b6 03b5 9900
00000f0: 1705 3605 a700 1119 0413 03c2 b603 b599
0000100: 0006 0636 0515 05aa 0000 001f 0000 0000
0000110: 0000 0003 0000 001d 0000 001d 0000 001d
0000120: 0000 001d 033d 1cac
Stackmap Table:
append_frame(@28,Integer,Object[#931])
append_frame(@73,Object[#200],Integer)
same_frame(@90)
same_frame(@104)
same_frame(@132)
chop_frame(@134,2)
same_frame(@137)
append_frame(@196,Object[#200],Integer)
same_frame(@213)
same_frame(@230)
same_frame(@247)
same_frame(@261)
same_frame(@292)
chop_frame(@294,2)
任何人都可以提出一些意见吗?感谢您的帮助。
配置:
Java 1.7
Maven 3+
最佳答案
您好,这与您应用程序中的某些字节码有关。 (请参阅有关 Java 7 兼容性更改的说明 http://www.oracle.com/technetwork/java/javase/compatibility-417013.html#incompatibilities,查看下面的一些行以了解 JSR 202)
你可以
-XX:-UseSplitVerifier
的java
编辑 即使答案已经有点老了。由于当前案例,我添加了一些更详细的解释。
Java 6 引入了类文件中的 StackMapTable
属性,当时甚至没有记录。
Foo.java
public class Foo {
public static boolean bar(String s) {
if (s.length() == 0) {
return true;
}
return false;
}
}
$ java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
$ javac Foo.java
$ javap -c -v Foo
Compiled from "Foo.java"
public class Foo extends java.lang.Object
SourceFile: "Foo.java"
minor version: 0
major version: 50
...
public static boolean bar(java.lang.String);
Code:
Stack=1, Locals=1, Args_size=1
0: aload_0
1: invokevirtual #2; //Method java/lang/String.length:()I
4: ifne 9
7: iconst_1
8: ireturn
9: iconst_0
10: ireturn
LineNumberTable:
line 3: 0
line 4: 7
line 6: 9
StackMapTable: number_of_entries = 1
frame_type = 9 /* same */
}
类 validator 没有检查属性是否在类中。
下面创建了没有 StackMatTable
属性的文件 Foo.class
。
FooDump.java
import org.objectweb.asm.*;
import java.io.*;
public class FooDump implements Opcodes {
public static void main(String[] args) throws Exception {
FileOutputStream fos = new FileOutputStream("Foo.class");
fos.write(dump());
fos.close();
}
public static byte[] dump() throws Exception {
ClassWriter cw = new ClassWriter(0);
FieldVisitor fv;
cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, "Foo", null, "java/lang/Object",
null);
MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null,
null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V",
false);
mv.visitInsn(RETURN);
mv.visitMaxs(1, 1);
mv.visitEnd();
mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "bar",
"(Ljava/lang/String;)Z", null, null);
mv.visitCode();
mv.visitVarInsn(ALOAD, 0);
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/String", "length", "()I",
false);
Label l0 = new Label();
mv.visitJumpInsn(IFNE, l0);
mv.visitInsn(ICONST_1);
mv.visitInsn(IRETURN);
mv.visitLabel(l0);
// this line would generate the StackMapTable attribute
// mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
mv.visitInsn(ICONST_0);
mv.visitInsn(IRETURN);
mv.visitMaxs(1, 1);
mv.visitEnd();
cw.visitEnd();
return cw.toByteArray();
}
}
编译运行
$ javac -cp asm-5.2.jar:asm-util-5.2.jar:. FooDump.java
$ java -cp asm-5.2.jar:asm-util-5.2.jar:. FooDump
检查 StackMapTable
属性不在文件中
$ javap -c -v Foo
public class Foo extends java.lang.Object
minor version: 0
major version: 50
...
public static boolean bar(java.lang.String);
Code:
Stack=1, Locals=1, Args_size=1
0: aload_0
1: invokevirtual #16; //Method java/lang/String.length:()I
4: ifne 9
7: iconst_1
8: ireturn
9: iconst_0
10: ireturn
}
FooDemo.java
public class FooDemo {
public static void main(String[] args) {
System.out.println("output: " + Foo.bar(""));
}
}
$ java -version
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
$ javac FooDemo.java
$java FooDemo
output: true
在 Java 7 中,类验证发生了变化。
对于版本 50 (Java 6) 的类文件,如果 StackMapTable
丢失或错误(参见:jvms-4.10.1),检查将进行故障转移。
使用 Java 6 的 Foo
类版本运行检查。
$ java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
$ javap -c -v Foo
Classfile /home/suboptimal/playground/Foo.class
Last modified Jun 9, 2017; size 232 bytes
MD5 checksum 5a7ea4a5dd2f6d1bcfddb9ffd720f9c9
public class Foo
minor version: 0
major version: 50 <-- class file Java 6
...
$ javac FooDemo.java
$ java FooDemo
output: true
类文件版本 51 (Java 7) 不再发生此故障转移。
要创建 Java 7 的 Foo
类版本,请修改 FooDump.java
的代码。
// cw.visit(V1_6, ACC_PUBLIC + ACC_SUPER, "Foo", null, "java/lang/Object", null);
cw.visit(V1_7, ACC_PUBLIC + ACC_SUPER, "Foo", null, "java/lang/Object", null);
编译运行
$ javac -cp asm-5.2.jar:asm-util-5.2.jar:. FooDump.java
$ java -cp asm-5.2.jar:asm-util-5.2.jar:. FooDump
检查它是一个类版本 51
$ java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
$ javap -c -v Foo
Classfile /home/suboptimal/playground/Foo.class
Last modified Jun 9, 2017; size 232 bytes
MD5 checksum cfd57fb547ac98a1b2808549f5e9e8c1
public class Foo
minor version: 0
major version: 51 <-- class file Java 7
...
$ javac FooDemo.java
$ java FooDemo
Exception in thread "main" java.lang.VerifyError: Expecting a stackmap frame at branch target 9 in method Foo.bar(Ljava/lang/String;)Z at offset 4
在 Java 7 中,可以使用选项 UseSplitVerifier 禁用 StackMapTable
属性的类型检查以退回到 Java 6 故障转移机制。 .
$ java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
$ java -XX:-UseSplitVerifier FooDemo
output: true
在 Java 8 中,StackMapTable
属性的验证成为强制性的,选项 UseSplitVerifier
被移除。
$ java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b132)
$ javap -c -v Foo
Classfile /home/suboptimal/playground/Foo.class
Last modified Jun 9, 2017; size 232 bytes
MD5 checksum cfd57fb547ac98a1b2808549f5e9e8c1
public class Foo
minor version: 0
major version: 51 <-- class file Java 7
...
$ javac FooDemo.java
$ java FooDemo
Exception in thread "main" java.lang.VerifyError: Expecting a stackmap frame at branch target 9
$ java -XX:-UseSplitVerifier FooDemo
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option UseSplitVerifier; support was removed in 8.0
Exception in thread "main" java.lang.VerifyError: Expecting a stackmap frame at branch target 9
注意始终使用 Java 6/7/8 的初始版本是为了表明行为从一开始就存在。
您可能会找到一些让它在 Java 8 上运行的建议...
$ java -noverify FooDemo
output: true
$ java -Xverify:none FooDemo
output: true
注意 这会禁用字节码 validator 。记住never disable bytecode verification in a production system .
关于java.lang.VerifyError : Expecting a stackmap frame at branch target 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26733946/
我有一个 div,我希望使用 css 显示为 :target。到目前为止,这工作正常。我的问题是:我希望它淡入淡出。 我的代码: Content #stuff { opacity:0;
我想找到在Rust构建中使用的libc.so文件,以便我可以使用--version进行查询。 (一些libcs通过C宏公开其版本信息,因此,它们的另一种选择是在构建脚本中使用cc条板箱。但其他诸如
我仍然不明白为什么 Makefile 中的“虚假”规则将“.PHONY”作为其目标。作为先决条件,这会更合乎逻辑。 我需要详细说明这一点吗?如果A依赖于B并且B是假的,那么A也是假的。因此,与 .PH
在 Fortran 语言中,向具有 TARGET 属性的虚拟参数的过程提供不具有 TARGET 属性的参数应该会导致无效代码。但是,当使用 gfortran (5.1.0) 或 ifort (14.0
如果有人发布过相同的问题,请原谅我,我找不到类似问题的答案。 当我单击带有 #dotNetComponents url 的按钮时,它会将我带到带有 dotNetComponents ID 的 div,
我想用 :target 伪类更改我的 html 中元素的样式。我的标记(第一个是按钮,第二个是目标元素): Call to action target CSS: #btn01:target { b
下面提到的示例代码是 Keith Wood 的 jQuery Countdown 插件的一部分。有人能解释一下吗 _attachCountdown: function(target, options)
我是 React 的新手。这绝对让我感到困惑。我可以使用 event.target 访问 HTML 元素,它显示的值等于某个数字,但每次我使用 event.target.value 时,我都会得到 u
这个问题是关于交叉编译的。 使用 swift 编译器的 -target 或 -target-cpu 选项可以使用哪些不同的目标?我在哪里可以找到概述? 它只能用于创建 iOS/watchOS 应用程序
在CKEditor 5中,我没有在链接对话框中看到目标属性的字段。 如何添加这样的字段?或将target = _blank设置为默认值。 谢谢 最佳答案 从Link Plugin的11.1.0版本开始
问题:FAKE 中是否有一个命令可以打印构建脚本中所有定义的目标? 我想以这样的方式设置我的 FAKE 构建:当我不指定目标时,它会打印构建脚本中所有可用目标的列表。 例如: > build.cmd
尝试使用 Visual Studio 2013 Update 3 创建一个新的 Cordova“空白应用程序”。 我看到了模板,但是当尝试打开空白应用程序时,我得到: The imported pro
http://download.oracle.com/javase/6/docs/api/java/lang/annotation/Target.html 此元注释指示声明的类型仅用作复杂注释类型声明
使用CocoaPods,有什么区别 target :TargetName do # Some pods... end 和 target "TargetName" do #
我正在尝试仅使用 CSS 制作一个简单的移动菜单切换。通过显示和隐藏两个按钮,这些按钮具有指向显示或隐藏导航菜单的类的不同链接。 是本教程的编辑link ,但现在我想让关闭和打开按钮位于单独的 div
以下是包含简单日志文件目标的简单 nlog 配置。我的问题是如何为 Nlog.Targets.Redis 添加目标? 最佳答案 以下是 NLog.Targets.Redis 的正确配置。如果
我想知道您是否可以将一个单元测试包链接到多个目标。因此,可以使用一个测试包测试所有应用程序目标。 我在所有应用程序目标之间有一些共享代码,但也有一些基于正在运行的应用程序目标的特定计算。 目前,如果我
我在 VSTS 中使用部署组将我的应用程序部署到本地测试 Web 服务器。 它已经运行良好很长时间了,但是在大约 6 周没有使用它之后,我现在遇到了这个错误,我想修复它; 最佳答案 您的代理未运行或无
使用 CMake 构建开源项目时(在我的例子中,它是柠檬图库),当我尝试通过 -DBUILD_SHARED_LIBS=1 构建共享库时出现此错误。 : TARGETS given no LIBRARY
尝试安装 ionic,添加 android 平台时出现以下错误 Error: Please install Android target "android-19". Hint: Run "androi
我是一名优秀的程序员,十分优秀!