The application runs using a self-packaged jacocoagent.jar. After subsequently using jacococli.jar to perform Pre-Instrumentation on a certain class, occurs NoClassDefFoundError or ClassNotFoundException for class org.jacoco.agent[...]Offline

33 views
Skip to first unread message

homejim he

unread,
Oct 28, 2024, 8:47:53 PM10/28/24
to JaCoCo and EclEmma Users
I have packaged my own jacocoagent.jar. After packaging, the package name for the internal package is org.jacoco.agent.rt.internal instead of the official org.jacoco.agent.rt.internal_aeaf9ab.

I have a scenario where I use Arthas to perform retransform, so I used the official jacococli.jar for offline instrumentation. However, after instrumentation, the introduced package is org.jacoco.agent.rt.internal_aeaf9ab instead of org.jacoco.agent.rt.internal, which results in a NoClassDefFoundError or ClassNotFoundException for the class org.jacoco.agent[...]Offline.

I also checked the similar issue in the JaCoCo FAQ https://www.jacoco.org/jacoco/trunk/doc/faq.html, but it does not address my specific problem.

How can I handle this situation? How can I ensure that the fully qualified name of the Offline class introduced by offline instrumentation is org.jacoco.agent.rt.internal.Offline instead of org.jacoco.agent.rt.internal_aeaf9ab.Offline?

Marc Hoffmann

unread,
Oct 29, 2024, 4:13:20 AM10/29/24
to JaCoCo and EclEmma Users
Hi,

there is a couple of reasons why we need to rename the runtime package, some are described here: https://www.jacoco.org/jacoco/trunk/doc/implementation.html

I see two options:

1) Use the JaCoCo build where the instrumentation and the runtime package use the same generated package name (which is derived from the Git commit id)
2) Also build your own jacococli.jar

Out of curiosity: Why do you need to build your own jacocoagent.jar in the first place?

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 visit https://groups.google.com/d/msgid/jacoco/c1cb6e2a-ab4d-4a80-a529-0b9419b20407n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages