Pontus Ullgren wrote:
Executing this with latest byteman works as expected, however when I change to byteman 1.0.3 it does not work anymore.
If this a known limitation or is there a way to solve this and get code injected into JVM classes ?
Yes, this is a known limitation of JDK5. The problem is that in JDK5 an agent transformer can only modify classes as they are loaded. Unfortunately java.lang.Thread is already loaded into the system before the Byteman agent is loaded so it never gets a chance to change this class. That's not the case for all classes in teh bootstrap classpath but it is fo rmany of the interesting ones. You can transform bootstrap classes if they are i) not loaded before the Byteman agent andf ii) not needed by the agent in order to perform the transformation. Otherwise you eill need to use JDK6 and Byteman versions >= 1.2.x.
I was afraid that I would get this answer :-)
I will see if we can switch to JDK6 for the testing of this or if there is some other way I can rewrite the rule so that it only needs to change classes that are not loaded before the byteman agent.