Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quarkus-jacoco produces tons of logged excepiions in 1.13 like Cannot transform java.lang.Object #16358

Closed
snazy opened this issue Apr 8, 2021 · 7 comments · Fixed by #16666
Labels
kind/bug Something isn't working
Milestone

Comments

@snazy
Copy link
Contributor

snazy commented Apr 8, 2021

Describe the bug

After some experiments how to change our code to get "proper code-coverage" of tests running via Quarkus, we've realized that 1.13.0 introduced the quarkus-jacoco extension, which solved our problem that the code-coverage with jacoco+Quarkus didn't work. However it introduced a new issue that Quarkus now complains that it can no longer instrument classes with messages like Cannot transform java.lang.Object as its containing application archive could not be found.. This happens both locally and in CI (GH infra). It seems to be a problem since 1.13.0.

Expected behavior

Quarkus + jacoco instrumentation + code-coverage not polluting the logs with those exceptions

Actual behavior

Tons of exceptions logged. Few examples:

java.lang.instrument.IllegalClassFormatException: Error while instrumenting io/quarkus/test/common/TestResourceManager.
2021-04-08 10:52:58,272 WARN  [io.qua.dep.ste.ClassTransformingBuildStep] (build-76) Cannot transform java.lang.Deprecated as its containing application archive could not be found.
2021-04-08 10:52:58,280 WARN  [io.qua.dep.ste.ClassTransformingBuildStep] (build-76) Cannot transform java.lang.Object as its containing application archive could not be found.

Example CI runs:

To Reproduce

git clone https://github.com/projectnessie/nessie.git
./mvnw clean install -DskipTests
./mvnw clean install -Pcode-coverage -pl servers/quarkus-server/

Configuration

application.properties in servers/quarkus-server/src/main/resources/application.properties

Environment (please complete the following information):

Output of uname -a or ver

github OSS CI

Output of java -version

openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing)

Quarkus version or git rev

1.13.0 + 1.13.1

@snazy snazy added the kind/bug Something isn't working label Apr 8, 2021
@CJUnderhill
Copy link

We are experiencing the same/a similar bug.

@famod
Copy link
Member

famod commented Apr 8, 2021

/cc @stuartwdouglas

@kucharzyk
Copy link
Contributor

Same issue here:

2021-04-21 01:03:06,700 WARN  [io.qua.dep.ste.ClassTransformingBuildStep] (build-28) Cannot transform java.lang.annotation.Documented as its containing application archive could not be found.
2021-04-21 01:03:06,711 WARN  [io.qua.dep.ste.ClassTransformingBuildStep] (build-28) Cannot transform java.lang.annotation.Target as its containing application archive could not be found.
2021-04-21 01:03:06,713 WARN  [io.qua.dep.ste.ClassTransformingBuildStep] (build-28) Cannot transform java.lang.annotation.Repeatable as its containing application archive could not be found.
2021-04-21 01:03:06,714 WARN  [io.qua.dep.ste.ClassTransformingBuildStep] (build-28) Cannot transform java.lang.annotation.Retention as its containing application archive could not be found.
2021-04-21 01:03:06,723 WARN  [io.qua.dep.ste.ClassTransformingBuildStep] (build-28) Cannot transform io.smallrye.context.Jdk12CompletableFutureWrapper as its containing application archive could not be found.
2021-04-21 01:03:06,724 WARN  [io.qua.dep.ste.ClassTransformingBuildStep] (build-28) Cannot transform io.smallrye.context.Jdk12CompletionStageWrapper as its containing application archive could not be found.

Warnings dissappears after removing quarkus-jacoco extension

@stuartwdouglas
Copy link
Member

The main issue is that both the plugin and the extension are in use, but when this is fixed there are other issues that the linked PR fixes.

@quarkus-bot quarkus-bot bot added this to the 2.0 - main milestone Apr 27, 2021
@gsmet gsmet modified the milestones: 2.0 - main, 1.13.3.Final Apr 27, 2021
@Manfred73
Copy link

Hi,

I'm using openjdk17 and setup a quarkus project using a getting started.

I've added some tests all annotated with @QuarkusTest.

When running coverage in Intellij, some classes result in 0% coverage and no jacoco reports were generated in the target folder.

After some googling I found: https://quarkus.io/guides/tests-with-coverage and added the quarkus-jacoco as a test dependency.
Jacoco reports are now generated in the target folder and with 100% coverage when I run it from Intellij (although still showing 0% in Intellij when running with jacoco) and I get lots of errors in the Intellij console. It spits out lots of exceptions for each test class:

java.lang.instrument.IllegalClassFormatException: Error while instrumenting ServiceTest.
......
Caused by: java.io.IOException: Error while instrumenting ServiceTest.
......
Caused by: java.lang.IllegalStateException: Cannot process instrumented class ServiceTest. Please supply original non-instrumented classes.

@Manfred73
Copy link

Any idea why these errors occur in Intellij and I get different results in Intellij? Is this an issue with the Jacoco plugin/Intellij?

@tbkahuna48
Copy link

Similar problem: thousands of this lines when building in Jenkins pipeline - but not locally.

2023-11-28 07:24:15,572 INFO [tc.tes.5.1] (build-39) Container testcontainers/ryuk:0.5.1 started in PT3.865865169S
2023-11-28 07:24:16,079 INFO [tc.mon.4] (build-39) Container mongo:4.4 is starting: ca69c4700c628e2f1ce2f57e88b27a0244129241fe5747c3c00d7a134358a61f
2023-11-28 07:24:17,704 INFO [tc.mon.4] (build-39) Container mongo:4.4 started in PT18.627700374S
java.lang.instrument.IllegalClassFormatException: Error while instrumenting io/quarkus/test/common/TestResourceManager with JaCoCo 0.8.11.202310140853/f33756c.
at org.jacoco.agent.rt.internal_4742761.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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
8 participants