gpt4 book ai didi

java - btrace VisualVM 接口(interface)需要 ASM 5

转载 作者:行者123 更新时间:2023-12-01 09:28:35 24 4
gpt4 key购买 nike

当我运行这个简单的 Java8 程序时

package test;

public class TraceInt {
public static void main(String args[]) throws InterruptedException{
TraceInt ti = new TraceInt();
while(true){
Integer.valueOf((int)System.currentTimeMillis());
ti.sleep(1000);
//System.getProperty("user.dir");
}
}

public void sleep(int millis){
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

并针对它运行这个 btrace 脚本

@OnMethod(
clazz = "/.*/",
method = "/java.lang.*/",
location = @Location(value = Kind.ENTRY, where = Where.BEFORE)
)
public static void onEntry(Object obj) {
println(Strings.strcat("on entry: ", identityStr(obj)));
}

我在程序中遇到此错误

java.lang.IllegalArgumentException: INVOKESPECIAL/STATIC on interfaces require ASM 5
at com.sun.btrace.org.objectweb.asm.MethodVisitor.visitMethodInsn(Unknown Source)
at com.sun.btrace.util.templates.TemplateExpanderVisitor.visitMethodInsn(TemplateExpanderVisitor.java:85)
at com.sun.btrace.org.objectweb.asm.MethodVisitor.visitMethodInsn(Unknown Source)
at com.sun.btrace.org.objectweb.asm.ClassReader.a(Unknown Source)
at com.sun.btrace.org.objectweb.asm.ClassReader.b(Unknown Source)
at com.sun.btrace.org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.sun.btrace.org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.sun.btrace.runtime.InstrumentUtils.accept(InstrumentUtils.java:66)
at com.sun.btrace.runtime.InstrumentUtils.accept(InstrumentUtils.java:62)
at com.sun.btrace.agent.Client.instrument(Client.java:392)
at com.sun.btrace.agent.Client.doTransform(Client.java:213)
at com.sun.btrace.agent.Client.transform(Client.java:165)
at sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428)
at sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
at sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:144)
at com.sun.btrace.agent.Main$4.run(Main.java:464)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

感谢任何帮助

最佳答案

过了一段时间,我意识到我正在使用旧版本的 btrace 来对抗 Java8。当我升级到最新版本时,一切都很好。

关于java - btrace VisualVM 接口(interface)需要 ASM 5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39643179/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com