I have written a Class with premain method and inside that method I have added a ClassFileTransformer to Instrumentation (Instrumentation.addTransformer()).
I have invoked a application using
java -javaagent:<path_to_agnet.jar> <application>
However ClassFileTransformer.transform() method is not being invoked.
I have observed that premain is being invoked.
I have also observed that if I call Instrumentation.retransformClasses(), then ClassFileTransformer.transform() is being invoked.
On first definition (Classloader.defineClass()), transform() method is not being invoked.
Any clue what could be wrong?
Note: I can post the source code if that is of any help.
Regards, Rejeev.