Closed kurb70 closed 2 weeks ago
@msupic could you look into this?
Hi, on one of my projects, I'm currently experiencing the same problem on a Micronaut migration from 4.1.6 to 4.4.2.
https://github.com/streamthoughts/jikkou
OpenJDK Runtime Environment GraalVM CE 21.0.1+12.1 (build 21.0.1+12-jvmci-23.1-b19)
Linux Ubuntu 22.04.3 LTS
Is there any workaround for this error?
@sdelamo @msupic
I tested it with Micronaut 4.6.0. Unfortunately I still get the same error.
It works for me https://github.com/micronaut-projects/micronaut-core/pull/11135 You might need to include graalvm plugin
I created a project with
curl --location --request GET 'https://launch.micronaut.io/create/default/com.a0dev.timerecviewer.TimeRecViewer?lang=JAVA&build=GRADLE&test=SPOCK&javaVersion=JDK_21&features=postgres&features=views-jte&features=graalvm' --output TimeRecViewer.zip
and also included include graalvm plugin
When executing nativeBuild
fail with this report
20:43:10: Executing 'nativeBuild'...
> Task :generateJte UP-TO-DATE
> Task :compileJava UP-TO-DATE
> Task :compileGroovy NO-SOURCE
> Task :processResources UP-TO-DATE
> Task :classes UP-TO-DATE
> Task :jar UP-TO-DATE
> Task :generateResourcesConfigFile UP-TO-DATE
> Task :nativeCompile
[native-image-plugin] GraalVM Toolchain detection is enabled
[native-image-plugin] GraalVM uses toolchain detection. Selected:
[native-image-plugin] - language version: 21
[native-image-plugin] - vendor: GraalVM Community
[native-image-plugin] - runtime version: 21.0.2+13-jvmci-23.1-b30
[native-image-plugin] Native Image executable path: /Users/kuba/.sdkman/candidates/java/21.0.2-graalce/lib/svm/bin/native-image
========================================================================================================================
GraalVM Native Image: Generating 'TimeRecViewer' (executable)...
========================================================================================================================
For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------
[1/8] Initializing... (7,6s @ 0,37GB)
Java version: 21.0.2+13, vendor version: GraalVM CE 21.0.2+13.1
Graal compiler: optimization level: 2, target machine: armv8-a
C compiler: cc (apple, arm64, 15.0.0)
Garbage collector: Serial GC (max heap size: 80% of RAM)
2 user-specific feature(s):
- com.oracle.svm.thirdparty.gson.GsonFeature
- io.micronaut.core.io.service.ServiceLoaderFeature
------------------------------------------------------------------------------------------------------------------------
Build resources:
- 12,09GB of memory (75,6% of 16,00GB system memory, determined at start)
- 8 thread(s) (100,0% of 8 available processor(s), determined at start)
[2/8] Performing analysis... [*] (88,4s @ 4,63GB)
37 993 reachable types (92,9% of 40 877 total)
61 426 reachable fields (67,6% of 90 879 total)
214 448 reachable methods (67,0% of 320 027 total)
11 505 types, 644 fields, and 7 876 methods registered for reflection
1 native library: -framework CoreServices
------------------------------------------------------------------------------------------------------------------------
35,0s (36,1% of total time) in 99 GCs | Peak RSS: 6,15GB | CPU load: 5,01
========================================================================================================================
Finished generating 'TimeRecViewer' in 1m 36s.
Error: Classes that should be initialized at run time got initialized during image building:
kotlin.coroutines.intrinsics.CoroutineSingletons was unintentionally initialized at build time. To see why kotlin.coroutines.intrinsics.CoroutineSingletons got initialized use --trace-class-initialization=kotlin.coroutines.intrinsics.CoroutineSingletons
To see how the classes got initialized, use --trace-class-initialization=kotlin.coroutines.intrinsics.CoroutineSingletons
> Task :nativeCompile FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
6 actionable tasks: 1 executed, 5 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':nativeCompile'.
> Process 'command '/Users/kuba/.sdkman/candidates/java/21.0.2-graalce/bin/native-image'' finished with non-zero exit value 1
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 1m 39s
20:44:50: Execution finished 'nativeBuild'.
Can you create and upload the project to GitHub, please?
Yes I can, but I created it via https://micronaut.io/launch/ and got there a project ZIP.
curl --location --request GET 'https://launch.micronaut.io/create/default/com.a0dev.timerecviewer.TimeRecViewer?lang=JAVA&build=GRADLE&test=SPOCK&javaVersion=JDK_21&features=postgres&features=views-jte&features=graalvm' --output TimeRecViewer.zip
Do you need more?
I got the same graalvm error when trying to use the JTE templates for Micronaut Views. It doesn't occur in other template engines, so maybe it's related to the kotlin jte dependency within micronaut-views-jte
Error: Classes that should be initialized at run time got initialized during image building: kotlin.coroutines.intrinsics.CoroutineSingletons was unintentionally initialized at build time. To see why kotlin.coroutines.intrinsics.CoroutineSingletons
It looks like we have mistakenly included Kotlin for JTE views.
Please exclude it with:
implementation("io.micronaut.views:micronaut-views-jte") {
exclude module: 'jte-kotlin'
}
Expected Behavior
Should build macOS native app without initializing during image building.
Actual Behaviour
I got an error: Classes that should be initialized at run time got initialized during image building: kotlin.coroutines.intrinsics.CoroutineSingletons …
Steps To Reproduce
I created an micronaut 4.4.1 app with
and immediately tried to build a native app.
Environment Information
Example Application
No response
Version
4.4.1