Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quarkus Native image building throws error: Image generation failed

I am trying to build the native Quarkus image using the GraalVM but I am running into following Build Failure error:

[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.9.2.Final:build (default) on project converter-service: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:400)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:240)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:925)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:833)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

This is the first time I am working with GraalVM so I am bit confused.

Following are the basic information: Java version 17 Graavl VM version graalvm-ce-javaV-22.1.0

I followed the steps provided: https://stackoverflow.com/a/65837409/7584240 and https://github.com/graalvm/homebrew-tap.

Then I ran the command: mvn package -Pnative but running into the error. I tried to run even mvn package -Dquarkus.package.type=native but still getting the error.

I looked at the following issue: https://github.com/quarkusio/quarkus/issues/6884 but the solution is not working for me.

Can someone please help me?

Update

When the same application was tried on Linux then everything is working correctly but on Macos the above error is being occurred. Is it due to Macos settings or some environment problem? If so how to fix this.

like image 917
BATMAN_2008 Avatar asked Nov 29 '25 02:11

BATMAN_2008


1 Answers

Able to figure out the issue so posting here:

  1. Increase the Docker memory resource from default 2GB to 8GB. (Docker Desktop -> Settings icon on top right -> Resources -> memory 2GB to 8GB apply and restart.)

  2. Then run the command mvn clean install -Dnative -Dquarkus.native.container-build=true

this should create a -runner file in project root/target folder.

like image 131
BATMAN_2008 Avatar answered Dec 01 '25 16:12

BATMAN_2008



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!