Bytecode Measurement System Classes in Java with ASM

My javaagent, run through -javagent tool classes with static method callbacks on one of my classes. This works great, besides system classes, for example. java / lang, java / util, which throw a ClassDefNotFounderror at the time the method is called (using INVOKESTATIC). So it looks like they are instrumented because the method call is being executed but has an access or visibility issue that my user classes do not have. My callback class and its methods are publicly available.

I tried adding my class to the classpath (and not just loading via -javaagent), but that didn't help. Is there any kind of protection for system classes that I need to override?

+3
source share
1 answer

It sounds like you are clearly looking for classes for the tool. Why don't you use java.lang.instrumentto intercept the classes that load when the target JVM is executed? See an example

Can you insert your code or related parts?

0
source

All Articles