Quarkus `3.10.0` now requires a GraalVM installation for quarkusDev when `quarkus.native.enabled` is set to true
Describe the bug
When upgrading Quarkus from a previous version to Quarkus 3.10.0, the Quarkus CLI migrates
quarkus.package.type=native
to
quarkus.package.jar.enabled=false
quarkus.native.enabled=true
With this change, the dev server ./gradleq quarkusDev can no longer start if any other OpenJDK distribution instead of GraalVM is installed.
With previous versions this worked, as for local development for example Eclipse Adoptium is sufficient and building and testing in native mode is only done by the CI pipeline.
Expected behavior
The local dev server ./gradleq quarkusDev should work if the following properties are set without GraalVM installed.
quarkus.package.jar.enabled=false
quarkus.native.enabled=true
Actual behavior
How to Reproduce?
No response
Output of uname -a or ver
Microsoft Windows [Version 10.0.22631.3447]
Output of java -version
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode, sharing)
Quarkus version or git rev
3.10.0
Build tool (ie. output of mvnw --version or gradlew --version)
Gradle 8.7
Additional information
implementation 'io.quarkus:quarkus-agroal'
implementation 'io.quarkus:quarkus-arc'
implementation 'io.quarkus:quarkus-awt'
implementation 'io.quarkus:quarkus-cache'
implementation 'io.quarkus:quarkus-config-yaml'
implementation 'io.quarkus:quarkus-jdbc-oracle'
implementation 'io.quarkus:quarkus-jdbc-postgresql'
implementation 'io.quarkus:quarkus-kubernetes'
implementation 'io.quarkus:quarkus-micrometer'
implementation 'io.quarkus:quarkus-micrometer-registry-prometheus'
implementation 'io.quarkus:quarkus-oidc'
implementation 'io.quarkus:quarkus-rest'
implementation 'io.quarkus:quarkus-rest-jackson'
implementation 'io.quarkus:quarkus-scheduler'
implementation 'io.quarkus:quarkus-smallrye-health'
implementation 'io.quarkus:quarkus-smallrye-openapi'
/cc @geoand (kubernetes), @iocanel (kubernetes), @zakkak (native-image)
I think this was indirectly caused by #39295. On reaugment, the dev mode processor forces the JAR type to be mutable-jar. Previously, this overrode the native-build setting, but now that native has its own flag, this no longer happens. It's a simple fix though.
The interim workaround would be to set quarkus.native.enabled=false while working in dev mode.
Hi @dmlloyd @geoand, the issue still persists in Quarkus 3.10.1+, the PR did not fix the issue in combination with Quarkus AWT. This issue was not there (also in combination with Quarkus AWT) before Quarkus 3.10.0, for example 3.9.4.
I just tried again with Quarkus 3.11.3 and there I get the following error. The Exception is thrown here: https://github.com/quarkusio/quarkus/blob/3.11.3/extensions/awt/deployment/src/main/java/io/quarkus/awt/deployment/AwtProcessor.java#L153
024-06-25 13:47:17,060 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.awt.deployment.AwtProcessor#setupJava2DClasses threw an exception: java.lang.RuntimeException: Failed to get GraalVM version
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunner.getGraalVMVersion(NativeImageBuildRunner.java:40)
at io.quarkus.awt.deployment.AwtProcessor.setupJava2DClasses(AwtProcessor.java:153)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
at java.base/java.lang.Thread.run(Thread.java:1583)
at org.jboss.threads.JBossThread.run(JBossThread.java:483)
Caused by: java.lang.RuntimeException: Cannot find the `native-image.cmd` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image`
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunnerError.getGraalVMVersionCommand(NativeImageBuildRunnerError.java:21)
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunner.getGraalVMVersion(NativeImageBuildRunner.java:29)
... 11 more
[error]: Build step io.quarkus.awt.deployment.AwtProcessor#setupAWTInit threw an exception: java.lang.RuntimeException: Failed to get GraalVM version
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunner.getGraalVMVersion(NativeImageBuildRunner.java:40)
at io.quarkus.awt.deployment.AwtProcessor.setupAWTInit(AwtProcessor.java:121)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
at java.base/java.lang.Thread.run(Thread.java:1583)
at org.jboss.threads.JBossThread.run(JBossThread.java:483)
Caused by: java.lang.RuntimeException: Cannot find the `native-image.cmd` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image`
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunnerError.getGraalVMVersionCommand(NativeImageBuildRunnerError.java:21)
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunner.getGraalVMVersion(NativeImageBuildRunner.java:29)
... 11 more
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:331)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:252)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:58)
at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:113)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:435)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:56)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:138)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:93)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.awt.deployment.AwtProcessor#setupJava2DClasses threw an exception: java.lang.RuntimeException: Failed to get GraalVM version
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunner.getGraalVMVersion(NativeImageBuildRunner.java:40)
at io.quarkus.awt.deployment.AwtProcessor.setupJava2DClasses(AwtProcessor.java:153)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
at java.base/java.lang.Thread.run(Thread.java:1583)
at org.jboss.threads.JBossThread.run(JBossThread.java:483)
Caused by: java.lang.RuntimeException: Cannot find the `native-image.cmd` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image`
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunnerError.getGraalVMVersionCommand(NativeImageBuildRunnerError.java:21)
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunner.getGraalVMVersion(NativeImageBuildRunner.java:29)
... 11 more
[error]: Build step io.quarkus.awt.deployment.AwtProcessor#setupAWTInit threw an exception: java.lang.RuntimeException: Failed to get GraalVM version
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunner.getGraalVMVersion(NativeImageBuildRunner.java:40)
at io.quarkus.awt.deployment.AwtProcessor.setupAWTInit(AwtProcessor.java:121)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
at java.base/java.lang.Thread.run(Thread.java:1583)
at org.jboss.threads.JBossThread.run(JBossThread.java:483)
Caused by: java.lang.RuntimeException: Cannot find the `native-image.cmd` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image`
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunnerError.getGraalVMVersionCommand(NativeImageBuildRunnerError.java:21)
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunner.getGraalVMVersion(NativeImageBuildRunner.java:29)
... 11 more
at io.quarkus.builder.Execution.run(Execution.java:123)
at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:160)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:327)
... 9 more
Suppressed: java.lang.RuntimeException: Failed to get GraalVM version
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunner.getGraalVMVersion(NativeImageBuildRunner.java:40)
at io.quarkus.awt.deployment.AwtProcessor.setupAWTInit(AwtProcessor.java:121)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
at java.base/java.lang.Thread.run(Thread.java:1583)
at org.jboss.threads.JBossThread.run(JBossThread.java:483)
Caused by: java.lang.RuntimeException: Cannot find the `native-image.cmd` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image`
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunnerError.getGraalVMVersionCommand(NativeImageBuildRunnerError.java:21)
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunner.getGraalVMVersion(NativeImageBuildRunner.java:29)
... 11 more
Caused by: java.lang.RuntimeException: Failed to get GraalVM version
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunner.getGraalVMVersion(NativeImageBuildRunner.java:40)
at io.quarkus.awt.deployment.AwtProcessor.setupJava2DClasses(AwtProcessor.java:153)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
at java.base/java.lang.Thread.run(Thread.java:1583)
at org.jboss.threads.JBossThread.run(JBossThread.java:483)
Caused by: java.lang.RuntimeException: Cannot find the `native-image.cmd` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image`
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunnerError.getGraalVMVersionCommand(NativeImageBuildRunnerError.java:21)
at io.quarkus.deployment.pkg.steps.NativeImageBuildRunner.getGraalVMVersion(NativeImageBuildRunner.java:29)
... 11 more
Can you please attach a sample project that fails as you describe?
Thanks
Hello Georgios,
we don't need any sophisticated reproducer,
I just tried to reproduce this by downloading the following code starter
https://code.quarkus.io/?g=io.quarkus&a=awt-graalvm-native-required&b=GRADLE&e=awt&e=rest&extension-search=origin:platform%20rest
and set quarkus.native.enabled=true inside the application.properties,
then start with ./gradlew quarkusDev.
I did not try with Maven, but I guess there we will get the exact same error.
I hope this helps!
Hi,
I tried with both Quarkus 3.11.3 and 3.12.0 with the application generated from the link to code.quarkus.io and both versions worked just fine.
@geoand remove your GRAALVM_HOME ENV var on your system, then you will get this error.
I did, still works
I just launched a fresh Windows 11 Sandbox, installed Eclipse Temurin 21, set the JAVA_HOME ENV var, and launched the Quarkus 3.12.0 code starter from above.
Did you restart the bash/PowerShell/cmd after removing the GraalVM ENV var from your system?
The same issue appears if I try the Maven code starter. Maybe it is Windows specific, idk (I have to use Windows, company policy).
Gradle
Maven
I don't have a Windows machine unfortunately...
I will try with a fresh WSL instance, maybe I can reproduce this also in a Linux distro.
~~I can confirm this is Windows-specific. On a fresh Windows Sandbox instance where I just set up Java and the code starter, I get the errors from the comment above (both Maven and Gradle).~~
~~I do not get the error on WSL2 with AlmaLinux 9.3 (Rocky Linux is not available in the Windows Store) and the Maven code starter.~~
Very interesting find!
~~So both Maven and Gradle with the Quarkus 3.12.0 code starter from above work fine under Linux.
I just tried Gradle to double-check.~~
Nevermind, it also does not work under Linux, I just forgot to add quarkus.native.enabled=true for both Maven and Gradle for the Quarkus 3.12.0 AWT and REST code starter 🤦🏽♂️🤦🏽♂️🤦🏽♂️
It is almost the same error, this time the stack trace from the GraalVM build -> container runtime detection.
You must do something different when you try to reproduce this @geoand as I also get the same error under Linux.
In addition to the GRAALVM_HOME ENV var, maybe also try to remove GraalVM from the PATH ENV var and JAVA_HOME.
Gradle
Maven
I've never been able to reproduce that, so best if someone else gives it a shot
It also does not matter if I add quarkus.package.jar.enabled=true, so I have both properties set to true.
quarkus.package.jar.enabled=true
quarkus.native.enabled=true
https://github.com/quarkusio/quarkus/wiki/Migration-Guide-3.10#packaging-configuration-gear-white_check_mark
With the Quarkus CLI 3.10.0+ migration the property quarkus.package.type=native was migrated automatically to:
quarkus.package.jar.enabled=false
quarkus.native.enabled=true
So we have a clear behavior change here regarding the AWT usage.
@geoand I was able to reproduce the issue (with 3.12.0) by:
-
unset GRAALVM_HOME -
export JAVA_HOME=~/jvms/jdk-21.0.4+3(that's Adoptium Temurin) -
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin(in my case sdkman was adding native-image to thePATH) - adding the following to the application properties:
quarkus.native.enabled=true
quarkus.package.jar.enabled=false
quarkus.native.container-build=false
Thanks @zakkak, I can now reproduce the problem.
This is actually rather serious...
Essentially anywhere we do @BuildStep(onlyIf = { NativeBuild.class }) is susceptible to this problem...
There are a few solutions I can think of, but none of them are great...
In ReaugmentTask, there is long-standing code to force the packaging (and disable native), which I would have expected to take effect in this case. But I don't see any equivalent code on the initial augmentation path. I'm not certain how it ever worked originally, assuming that it did. But if it did work before, it seems likely to me that it is another side effect of splitting the native-enabled flag out from packaging type.
it seems likely to me that it is another side effect of splitting the native-enabled flag out from packaging type
Very likely
Is this fixed in Quarkus 3.13.X?
@ThoSap this should be fixed since 3.11 by https://github.com/quarkusio/quarkus/pull/40496
I tried reproducing it on 3.13 with no luck. Are you still seeing the issue?
Let's close for now.
If it's still a problem, please mention it and we can reopen