简体   繁体   English

使用ASM的Java中的字节码检测系统类

[英]Bytecode instrumentation system classes in Java with ASM

My javaagent, run via -javagent, instruments classes with callbacks to static methods on one of my classes. 我的javaagent,通过-javagent运行,在我的一个类上使用回调调用类到静态方法。 This works great, apart from on system classes, eg java/lang, java/util, which throw ClassDefNotFounderror at the point when the method is called (with INVOKESTATIC). 除了系统类之外,这很有用,例如java / lang,java / util,它在调用方法时使用INVOKESTATIC抛出ClassDefNotFounderror。 So it appears they are instrumented, because the method call is attempted, but have an access or visibility issue that my user classes don't have. 因此看起来它们是检测的,因为尝试了方法调用,但是具有我的用户类没有的访问或可见性问题。 My callback class and its methods are all public. 我的回调类及其方法都是公开的。

I've tried adding my class to the classpath (instead of just loading via -javaagent) but that didn't help. 我已经尝试将我的类添加到类路径(而不是仅通过-javaagent加载),但这没有帮助。 Is there some protection of system classes I need to override? 我需要覆盖一些系统类保护吗?

It sounds like you're explicitly looking for classes to instrument. 听起来你明确地在寻找要测试的课程。 Why aren't you using java.lang.instrument to intercept classes that are being loaded when the target JVM executes? 为什么不使用java.lang.instrument拦截目标JVM执行时正在加载的类? See this example 看这个例子

Can you paste your code, or the relevant parts? 您可以粘贴代码或相关部分吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用ASM的Java字节码检测,MethodVisitor为空 - Java bytecode instrumentation using ASM, MethodVisitor is null 使用ASM的Java字节码检测:在INVOKESPECIAL指令处对代码注入进行VerifyError - Java Bytecode instrumentation with ASM: VerifyError on code injection at INVOKESPECIAL instructions Java字节码检测的替代方案 - Alternatives to Java bytecode instrumentation 本机java字节码检测 - native java bytecode instrumentation 与ASM字节码检测功能不兼容的参数 - Incompatible argument to function with ASM bytecode instrumentation 我正在尝试学习用于字节码检测的Java ASM框架,但无法在其上找到足够的文档或教程 - I am trying to learn java asm framework for bytecode instrumentation but not able to find sufficient docs or tutorials on it 使用asm完成字节码检测后,将引发java.lang.reflect.InvocationTargetException。 - java.lang.reflect.InvocationTargetException gets thrown when bytecode instrumentation is finished with asm. Java字节码检测代理问题 - Problems with Java Agent for Bytecode Instrumentation 使用ASM字节码检测在堆栈上加载构造函数参数(值) - Load constructor argument (values) on stack using ASM bytecode instrumentation ASM:输出java字节码和操作码 - ASM: outputting java bytecode and opcode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM