My custom transform failed

18 views
Skip to first unread message

nipi...@gmail.com

unread,
Mar 19, 2020, 1:50:25 PM3/19/20
to JaCoCo and EclEmma Users
Dear Jacoco Team,

I 'm stuck at the problem that my simple custom java agent don't work correctly.

My custom agent 's purpose is that adding some code fragment to specific classes by Javassist API.

My App started by Jetty.

Firstly, I config jvm options to make jacoco agent correctly such as "-javaagent:[mypath/]jacocoagent.jar".

And then I config jvm options such as "-javaagent:[mypath/]myagent.jar".

It make me confused that my agent only transform the classes from directory of Jetty lib, no one of my application's busness classes is transformed.

I guess the reason is that my app busyness classes and agent classes are loaded by different classloader.

App busyness classes are loaded by webappclassloader of jetty, and agent classed are loaded by sun.misc.Launcher$AppClassLoader.

May I have your text about how jacoco fix the different classloader problem. Thanks.

Marc Hoffmann

unread,
Mar 19, 2020, 6:43:38 PM3/19/20
to jac...@googlegroups.com
Hi,

a Java agent should see all classes loaded by the JVM, even when different class loaders are used. Therefore JaCoCo has no special code to get all classes instrumented.

Regards,
-marc
> --
> You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/7d86db7c-d85a-42f2-9d20-b1f93650aadf%40googlegroups.com.

Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages