java.lang.instrument.IllegalClassFormatException when upgrading to gradle 8 and jacoco 0.8.8

222 views
Skip to first unread message

Ganeshwaran Gabilan

unread,
Jun 1, 2023, 10:13:11 PM6/1/23
to JaCoCo and EclEmma Users
Hi Team,

I'm getting the following error with gradle 8.1 and  jacoco version 0.8.8. 
```
java.lang.instrument.IllegalClassFormatException: Error while instrumenting java/sql/Time.
at org.jacoco.agent.rt.internal_43f5073.CoverageTransformer.transform(CoverageTransformer.java:94)
at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541)
at java.base/java.lang.ClassLoader.defineClass2(Native Method)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1103)
at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:182)
at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:821)
at java.base/jdk.internal.loader.BuiltinClassLoader.findClassInModuleOrNull(BuiltinClassLoader.java:741)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:665)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:700)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:669)
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:375)
at picocli.CommandLine$Interpreter.registerBuiltInConverters(CommandLine.java:10839)
at picocli.CommandLine$Interpreter.<init>(CommandLine.java:10797)
at picocli.CommandLine.<init>(CommandLine.java:222)
at picocli.CommandLine.<init>(CommandLine.java:196)
```
I just replaced the gradle `jacocoMerge` task with the `jacocoReport` task. What could be the issue?

Thanks and regards,
Gabil.

Marc Hoffmann

unread,
Jun 2, 2023, 1:14:04 AM6/2/23
to jac...@googlegroups.com
Hi Gabil,

can you please provide the full stack trace? There should be a “caused by” section.

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/b97464d1-25c2-4bf4-98aa-770a5bdde2f2n%40googlegroups.com.

Evgeny Mandrikov

unread,
Jun 7, 2023, 9:45:31 AM6/7/23
to JaCoCo and EclEmma Users
On Friday, June 2, 2023 at 7:14:04 AM UTC+2 Marc R. Hoffmann wrote:
Hi Gabil,

can you please provide the full stack trace? There should be a “caused by” section.

Regards,
-marc

On 2. Jun 2023, at 04:13, Ganeshwaran Gabilan <gabil...@gmail.com> wrote:

Hi Team,

I'm getting the following error with gradle 8.1 and  jacoco version 0.8.8. 
```
java.lang.instrument.IllegalClassFormatException: Error while instrumenting java/sql/Time.
at org.jacoco.agent.rt.internal_43f5073.CoverageTransformer.transform(CoverageTransformer.java:94)
```
I just replaced the gradle `jacocoMerge` task with the `jacocoReport` task. What could be the issue?

Note that this is clearly not JaCoCo version 0.8.8

Because starting from version 0.8.8 messages of exceptions occurring during analysis or instrumentation include JaCoCo version - https://github.com/jacoco/jacoco/pull/1217
Moreover package org.jacoco.agent.rt.internal_43f5073 corresponds to JaCoCo version 0.8.5,
which supports class files of Java versions only up to 13, so I'm ready to bet that this exception is due to the use of the old JaCoCo version with a Java version greater than 13.

Ganeshwaran Gabilan

unread,
Jun 9, 2023, 12:06:43 PM6/9/23
to jac...@googlegroups.com, Mand...@gmail.com
Thank you for your support. 

Yes, @Mand...@gmail.com you are right. A locally added jacoco-0.8.5 JAR has been used in my project instead of jacoco version 0.8.8. Thank you for pointing that out. 

Kind regards,
Gabil.

--
You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/6O8Dtc0LZwg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/af9730ac-764f-4391-b059-3f7b2ac07b71n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages