question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mvnw build a container image successful depsite of a Java exception thrown during build but where is the image created?

See original GitHub issue

Describe the bug (Describe the problem clearly and concisely.) My environment: Windows 10 laptop, 64 bit 8 GB RAM Running Docker Desktop - allocated 2 CPUs and 3.75 GB (could not allocate 4GB or more - not enough memory) Using Windows Command Prompt to create a container image:

mvnw package -Pnative -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true

Build succeeded but an exception was thrown - why? And there is no image that I can see. Was it built correctly?

...
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from C:\Users\JACKHu\Documents\JHU\Quarkus_Java\quarkus-greeting-app\target\quarkus-greeting-app-1.0-SNAPSHOT-native-image-source-jar\quarkus-greeting-app-1.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Checking image status quay.io/quarkus/ubi-quarkus-native-image:20.1.0-java11
20.1.0-java11: Pulling from quarkus/ubi-quarkus-native-image
Digest: sha256:c07a3948da2cf7fb43decc078bcc772cf19ce37077887e92cee4a1bde7b8cd7e
Status: Image is up to date for quay.io/quarkus/ubi-quarkus-native-image:20.1.0-java11
quay.io/quarkus/ubi-quarkus-native-image:20.1.0-java11
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 20.1.0 (Java Version 11.0.7)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] docker run -v //c/Users/JACKHu/Documents/JHU/Quarkus_Java/quarkus-greeting-app/target/quarkus-greeting-app-1.0-SNAPSHOT-native-image-source-jar:/project:z --env LANG=C --rm quay.io/quarkus/ubi-quarkus-native-image:20.1.0-java11 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Duser.language=en -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -H:+JNI -jar quarkus-greeting-app-1.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:-UseServiceLoaderFeature -H:+StackTrace quarkus-greeting-app-1.0-SNAPSHOT-runner
Build on Server(pid: 27, port: 35513)*
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]    classlist:  16,013.35 ms,  0.96 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]        (cap):   1,770.59 ms,  0.96 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]        setup:   4,808.59 ms,  0.96 GB
java.lang.ClassNotFoundException: sun.security.ssl.Debug
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:398)
        at io.quarkus.runner.AutoFeature.beforeAnalysis(AutoFeature.zig:845)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$7(NativeImageGenerator.java:679)
        at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:679)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:538)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:451)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
23:17:56,421 INFO  [org.jbo.threads] JBoss Threads version 3.1.1.Final
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]     (clinit):     710.52 ms,  1.10 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]   (typeflow):  41,649.13 ms,  1.10 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]    (objects):  30,255.72 ms,  1.10 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]   (features):     744.89 ms,  1.10 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]     analysis:  75,085.66 ms,  1.10 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]     universe:   2,327.30 ms,  1.10 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]      (parse):  12,768.65 ms,  1.17 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]     (inline):  11,652.27 ms,  1.33 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]    (compile):  67,250.17 ms,  1.38 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]      compile:  93,742.00 ms,  1.38 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]        image:   4,767.43 ms,  1.38 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]        write:   3,243.70 ms,  1.38 GB
[quarkus-greeting-app-1.0-SNAPSHOT-runner:27]      [total]: 200,781.65 ms,  1.38 GB
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 214750ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:56 min
[INFO] Finished at: 2020-08-22T00:20:22+01:00
[INFO] ------------------------------------------------------------------------

I cannot see where the created image is.

C:\Users\JACKHu\Documents\JHU\Quarkus_Java\quarkus-greeting-app\target>docker images
REPOSITORY                                 TAG                 IMAGE ID            CREATED             SIZE
quay.io/quarkus/ubi-quarkus-native-image   20.1.0-java11       bc4e5f1671af        38 hours ago        1.29GB
ruby-sample-app                            latest              963b70cf09da        8 months ago        570MB
jackhu008/halloween2019                    latest              e2d837a83620        9 months ago        4.28MB
halloween2019                              latest              e2d837a83620        9 months ago        4.28MB
centos/ruby-22-centos7                     latest              e42d0dccf073        2 years ago         566MB

The quarkus base image was shown but no image for quarkus-greeting-app.

In the \target folder there is a runner file generated alongside a few .jar file:

22/08/2020  00:20    <DIR>          quarkus-greeting-app-1.0-SNAPSHOT-native-image-source-jar
22/08/2020  00:20        27,945,184 quarkus-greeting-app-1.0-SNAPSHOT-runner
20/08/2020  23:38           239,693 quarkus-greeting-app-1.0-SNAPSHOT-runner.jar
20/08/2020  23:38             7,342 quarkus-greeting-app-1.0-SNAPSHOT.jar
20/08/2020  22:59             6,282 quarkus-greeting-app-dev.jar

Expected behavior (Describe the expected behavior clearly and concisely.) Expected Build Success and no exceptions.

Actual behavior (Describe the actual behavior clearly and concisely.)

Build succeeded but an exception was thrown.

To Reproduce Steps to reproduce the behavior: 1. 2. 3.

Configuration

# Add your application.properties here, if applicable.

Screenshots (If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • Output of uname -a or ver:
  • Output of java -version:
  • GraalVM version (if different from Java):
  • Quarkus version or git rev:
  • Build tool (ie. output of mvnw --version or gradlew --version):

Additional context (Add any other context about the problem here.)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
gsmetcommented, Aug 25, 2020

Hum, we need to fix this doc. It’s incorrect nowadays. I will fix it.

On Tue, Aug 25, 2020 at 6:47 PM jackhu1 notifications@github.com wrote:

Hello @jaikiran https://github.com/jaikiran good spot! Not sure how you managed to deduce I used JDK 8 as there is no clear statement saying that, but I did use JDK 8. I was following an online tutorial which specified using JDK 8: https://quarkus.io/guides/building-native-image

Does anyone know how well is the backward compatibility of Java 11 to Java 8? Or is there an option to specifying using Java 8 native-image instead of the default Java 11?

I have other work related applications that run on Java 8 and obviously I want to be cautious to avoid breaking those from upgrading JRE.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/quarkusio/quarkus/issues/11539#issuecomment-680142876, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJYOBJYV2HCNQ6NNY6MKW3SCPTKBANCNFSM4QHYFXAA .

0reactions
jackhu1commented, Aug 28, 2020

Hello @jaikiran thanks for your reply. The -runner is the native executable. It is not the container image that I am looking for. I think I now understand why my mvnw package ... build did not create a container image now: I did not adding the required docker extension to my project before build!

Fixed: I first added quarkus-container-image-docker to my project by running below command: mvnw quarkus:add-extension -Dextensions="container-image-docker"

Then re-run the same build command as before:

mvnw package -Pnative -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true
...
[INFO] [io.quarkus.container.image.docker.deployment.DockerProcessor] Built container image jackhu/quarkus-greeting-app:1.0-SNAPSHOT (26e11492d9b6)
...
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
...

The build created a new Docker container image as shown above: jackhu/quarkus-greeting-app:1.0-SNAPSHOT. The presence of the new image is also confirmed by querying my local Docker image repository:

docker images
REPOSITORY                                    TAG                 IMAGE ID            CREATED             SIZE
jackhu/quarkus-greeting-app                   1.0-SNAPSHOT        26e11492d9b6        53 seconds ago      134MB
quarkus/quarkus-greeting-app                  latest              a679861299b6        47 hours ago        135MB
Read more comments on GitHub >

github_iconTop Results From Across the Web

Maven compilation failure when building Dockerfile
When trying to build a Docker image I get this Compilation error, this occurs at this specific step after downloading a bunch of...
Read more >
Build a Docker image using Maven and Spring Boot - Medium
Run the standard command mvn package and on completion you should see a message indicating the Docker image has been successfully created. Once ......
Read more >
Exception Handling in Java: How-to Tutorial, Examples & More
Throwing Exceptions. An Exception in Java can be handled by using the throw keyword and creating a new Exception or re-throwing an already ......
Read more >
Tanzu Application Platform v1.0 | VMware Docs
You have successfully deployed your application on the. Tanzu Application Platform. 105. Section 4: Configure image signing and verification ...
Read more >
Java Exceptions And Exception Handling With Examples
You will learn about Exception Hierarchy, Types, Class Methods & more: When we are executing Java programs, the normal behavior or normal flow ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found