You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Root project
Spring Boot gradle plugin is defined in the build.gradle.kts file, but it is not applied.
plugins {
id("org.springframework.boot") version "3.4.4" apply false
}
cli subproject
The following plugins are applied:
plugins {
java
id("org.springframework.boot")
id("org.graalvm.buildtools.native") version "0.10.6"
}
If I execute a ./gradlew cli:nativeRun command, I get this error from the running application:
org.springframework.boot.AotInitializerNotFoundException: Startup with AOT mode enabled failed: AOT initializer cli.CliMain__ApplicationContextInitializer could not be found
at org.springframework.boot.SpringApplication.addAotGeneratedInitializerIfNecessary(SpringApplication.java:426)
at org.springframework.boot.SpringApplication.prepareContext(SpringApplication.java:382)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:317)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1350)
at cli.CliMain.main(CliMain.java:12)
at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Case 2
Given the following gradle project structure
Root project
Spring Boot gradle plugin is defined in the build.gradle.kts file, but it is not applied. Also the GraalVM plugin is defined, but not applied. Note: The difference here is, that in case 1 the GraalVM plugin is not here.
plugins {
id("org.springframework.boot") version "3.4.4" apply false
id("org.graalvm.buildtools.native") version "0.10.6" apply false
}
If I execute a ./gradlew cli:nativeRun command, the command runs without any problem.
It seems the problem is a class loading issue. The org.springframework.boot.gradle.plugin.SpringBootPlugin tries to load several other plugin classes. (Line: 149). In case 1, when the org.springframework.boot.gradle.plugin.NativeImagePluginAction.getPluginClass() is called, the method throws a NoClassDefFoundError, which will be caught, and the NativeImagePlugnAction will be skipped.
In case 2, the org.springframework.boot.gradle.plugin.NativeImagePluginAction.getPluginClass() doesn't throw a NoClassDefFoundError, soe the the NativeImagePluginAction can apply its things on the project.
The exceptation would be either the case 1 works, or the documentation mention that, that the GraalVM gradle plugin has to be loaded in root project.
The two cases are in the two zip files. The reproduction: execute the ./gradlew cli:nativeRun command. GraalVM has to be the active Java implementation. The native-image command of GraalVM needs some additional tools/libraries: Copied from https://www.graalvm.org/latest/reference-manual/native-image/: "header files for the C library, glibc-devel, zlib, gcc, and/or libstdc++-static".
Version information
Java
openjdk version "24.0.1" 2025-04-15
OpenJDK Runtime Environment GraalVM CE 24.0.1+9.1 (build 24.0.1+9-jvmci-b01)
OpenJDK 64-Bit Server VM GraalVM CE 24.0.1+9.1 (build 24.0.1+9-jvmci-b01, mixed mode, sharing)
Case 1
Given the following gradle project structure.
Root project
Spring Boot gradle plugin is defined in the build.gradle.kts file, but it is not applied.
cli subproject
The following plugins are applied:
If I execute a ./gradlew cli:nativeRun command, I get this error from the running application:
Case 2
Given the following gradle project structure
Root project
Spring Boot gradle plugin is defined in the build.gradle.kts file, but it is not applied. Also the GraalVM plugin is defined, but not applied. Note: The difference here is, that in case 1 the GraalVM plugin is not here.
cli subproject
The following plugins are applied.
If I execute a ./gradlew cli:nativeRun command, the command runs without any problem.
It seems the problem is a class loading issue. The org.springframework.boot.gradle.plugin.SpringBootPlugin tries to load several other plugin classes. (Line: 149). In case 1, when the org.springframework.boot.gradle.plugin.NativeImagePluginAction.getPluginClass() is called, the method throws a NoClassDefFoundError, which will be caught, and the NativeImagePlugnAction will be skipped.
In case 2, the org.springframework.boot.gradle.plugin.NativeImagePluginAction.getPluginClass() doesn't throw a NoClassDefFoundError, soe the the NativeImagePluginAction can apply its things on the project.
The exceptation would be either the case 1 works, or the documentation mention that, that the GraalVM gradle plugin has to be loaded in root project.
The two cases are in the two zip files. The reproduction: execute the
./gradlew cli:nativeRun
command. GraalVM has to be the active Java implementation. The native-image command of GraalVM needs some additional tools/libraries: Copied from https://www.graalvm.org/latest/reference-manual/native-image/: "header files for the C library, glibc-devel, zlib, gcc, and/or libstdc++-static".Version information
Java
Spring Boot plugin
3.4.4
case1.zip
case2.zip
The text was updated successfully, but these errors were encountered: