ApplicationInsights-Java
ApplicationInsights-Java copied to clipboard
Upgrade Gradle to 9.1.0
Followed upgrade guide Upgrading within Gradle 9.x.y, which requires following the older migration guide first: Upgrading to Gradle 9.0.0.
Many test failed. Example:
ConsumptionPlanEnabledTest$Java8Test STANDARD_OUT
Test failure detected.
Container logs:
Picked up JAVA_TOOL_OPTIONS: -Dapplicationinsights.testing.batch-schedule-delay-millis=500 -javaagent:/applicationinsights-agent.jar -Dapplicationinsights.testing.statsbeat.ikey=00000000-0000-0000-0000-0FEEDDADBEEG -Dapplicationinsights.testing.statsbeat.endpoint=http://host.testcontainers.internal:6060/
2025-10-14 00:18:49.255Z INFO c.m.applicationinsights.agent - Application Insights Java Agent 3.7.5-SNAPSHOT started successfully (PID 1, JVM running for 6.513 s)
2025-10-14 00:18:49.265Z INFO c.m.applicationinsights.agent - Java version: 1.8.0_462, vendor: Temurin, home: /opt/java/openjdk/jre
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/springframework/boot/loader/launch/JarLauncher has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
Root cause
Spring Boot 3.x is compiled for (and requires) Java 17+. Its boot loader classes (including org.springframework.boot.loader.launch.JarLauncher) are built with class file version 61.0 (Java 17).
Java 8 can only load up to class file version 52.0, so the JVM aborts before the app starts: UnsupportedClassVersionError.
The problem is Spring Boot 3.x dropped support for Java 8. However, 2.7.18 (latest in 2.x.y) doesn't support Gradle 9.0.