New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraalVM image not working with JAX-RS feature #577
Comments
I also tried adding --no-fallback in the native image build command. When I did that, I got this : Step 1/10 : FROM oracle/graalvm-ce:20.2.0-java8 as graalvm �[0m�[91mcom.oracle.svm.core.util.UserError$UserException: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: io.micronaut.runtime.Micronaut. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time. @aalmiray Can someone tell me if it is a bug or I am doing something wrong? |
Can you try with with |
Also please try the latest version of launch which is 2.2.0 |
I am using 2.2.0 and I tried -Dpacking option as suggested by you. Same results: During the dockerization process, I can see graalVM warning saying standalone image creation is being aborted. That gave me the hint that it wont work and docker run gave the confirmation. |
As per the error it seems you have misconfigured your JAVA_HOME variable |
Where? It's a docker build command execution which is creating a not
executable container? Where should I configure the JAVA_HOME? Inside the
Dockerfile given by Micronaut? Or on my laptop? How is my laptop's
JAVA_HOME is gonna impact the docker build process?
…On Mon, Nov 23, 2020 at 7:31 PM Graeme Rocher ***@***.***> wrote:
As per the error it seems you have misconfigured your JAVA_HOME variable
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#577 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACE5DTRNVUWD76HNADES53LSRJTMJANCNFSM4T5ODRNQ>
.
|
I have no idea regarding the
With the error:
|
Reported micronaut-projects/micronaut-jaxrs#75 to track the issue with JAX-RS Adding <plugin>
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>native-image-maven-plugin</artifactId>
<configuration>
<buildArgs>
<arg>--initialize-at-run-time=io.micronaut.jaxrs.runtime.ext.impl.LinkImpl</arg>
</buildArgs>
</configuration>
</plugin> Resolves the issue when running @alvarosanchez How to get this config propagated to Docker? |
@graemerocher I think that |
of course that is why I reported micronaut-projects/micronaut-jaxrs#75 |
I'm sorry but then I don't understand why we need to "propagate the config to Docker"... |
To provide a workaround to the user for the issue until a fix is released |
Oh, I see, thank you. Another option is create the file |
@ilopmar What should be added to the native-image properties ? Also a big question - Framework - 2.2.0, Language - Java. Build tool - Maven, and Test tool (does not matter) - JUnit along with GraalVM - Isnt this the most obvious and common thing people start with? And when in today's world docker is almost defacto and one of the major reason, I guess, people migrate to your framework is the smaller footprint, how can something be released without testing the test case - Is the graalvm native image based docker container is running or not running? Looks like it is not running. My feedback on user experience, if that matters: |
@AbhideepChakravarty Thanks for the feedback. As it happens you chose to use the JAX-RS feature which very few users actually use as most Micronaut users just use the built in annotations. It seems a bug slipped into the release whereby JAX-RS doesn't work in native image and you were the first to spot it, sorry for the bad luck |
@AbhideepChakravarty You can create the file Args = --initialize-at-run-time=io.micronaut.jaxrs.runtime.ext.impl.LinkImp |
@graemerocher Looks like thats always me !! |
@ilopmar I tried that and executed mvn package -Dpackaging=docker-native. Post that I did docker build . -t aawp-rest:m5. Got the same JAVA_HOME error while running the image. Then I added --no-fallback in Dockerfile and re-run docker build . -t aawp-rest:m6 and got this:
|
@AbhideepChakravarty You are still building images yourself with If you have your own |
Thanks for reporting an issue, please review the task list below before submitting the
issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.
NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (http://stackoverflow.com/tags/micronaut) or Gitter (https://gitter.im/micronautfw/). DO NOT use the issue tracker to ask questions.
Description
GraalVM native-image asks for JAVA_HOME or it cant find Micronaut.
I used the launcher and created an Application with Maven and JUnit. I added features including GraalVM and Jax-RS. I w
Task List
Steps to Reproduce
Error: No bin/java and no environment variable JAVA_HOME
Stack Trace
d:\Eclatian\Code\aawp\AppAdminWebAppRoot\facade\aawp-rest>docker build . -t aawp-rest:m1
[+] Building 526.0s (14/14) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 386B 0.1s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/frolvlad/alpine-glibc:latest 4.0s
=> [internal] load metadata for docker.io/oracle/graalvm-ce:20.2.0-java8 4.0s
=> [internal] load build context 11.7s
=> => transferring context: 7.47MB 11.6s
=> [stage-1 1/3] FROM docker.io/frolvlad/alpine-glibc@sha256:3a41627f9f0d51bef379b1c407a95f8635fb5a96751699e09825fd8e6fb69666 15.9s
=> => resolve docker.io/frolvlad/alpine-glibc@sha256:3a41627f9f0d51bef379b1c407a95f8635fb5a96751699e09825fd8e6fb69666 0.0s
=> => sha256:3a41627f9f0d51bef379b1c407a95f8635fb5a96751699e09825fd8e6fb69666 739B / 739B 0.0s
=> => sha256:4c5945fbf2212c603ed8843b4153f9cb528f5fd99f07c49da5d27b86eb06c922 6.09kB / 6.09kB 0.0s
=> => sha256:df20fa9351a15782c64e6dddb2d4a6f50bf6d3688060a34c4014b0d9a752eb4c 2.80MB / 2.80MB 8.1s
=> => sha256:05154a797e786e7192036bc0459c2812c3c7574bf1566537ef90ab49b32a5774 5.72MB / 5.72MB 14.0s
=> => extracting sha256:df20fa9351a15782c64e6dddb2d4a6f50bf6d3688060a34c4014b0d9a752eb4c 0.8s
=> => extracting sha256:05154a797e786e7192036bc0459c2812c3c7574bf1566537ef90ab49b32a5774 1.2s
=> [graalvm 1/5] FROM docker.io/oracle/graalvm-ce:20.2.0-java8@sha256:c0d9cd0620320dd8986bfdc11456edeb2a65efc3f1e02f59d4f33eb6511ae9e5 303.2s
=> => resolve docker.io/oracle/graalvm-ce:20.2.0-java8@sha256:c0d9cd0620320dd8986bfdc11456edeb2a65efc3f1e02f59d4f33eb6511ae9e5 0.0s
=> => sha256:c0d9cd0620320dd8986bfdc11456edeb2a65efc3f1e02f59d4f33eb6511ae9e5 1.37kB / 1.37kB 0.0s
=> => sha256:94c408b2294729bc4c237d2f6c13d8ce5302aefdccc05d85f3c7e1641654f80a 4.86kB / 4.86kB 0.0s
=> => sha256:bce8f778fef067eed3d092243c838d674cb1ef39441d85d0ca84382084a69093 48.01MB / 48.01MB 92.7s
=> => sha256:8a3069484c0d1b37d049a11df986a5701ea6ef427bade131c73dd5c7e6038905 80.26MB / 80.26MB 124.0s
=> => sha256:257411b393455c190751fb43c658b4d3523d412721bda019e275ff8b6ab2ef05 3.42kB / 3.42kB 17.3s
=> => sha256:b1eb54da10569d3bfdc4b376a0324b4d89e69ce0ebe4245ac788679a7ce9f894 554B / 554B 19.2s
=> => sha256:467749c910c8837ed3e728f68d032be5b9aa90e748f2301a5df20e68b5b9f46b 342.33MB / 342.33MB 244.3s
=> => extracting sha256:bce8f778fef067eed3d092243c838d674cb1ef39441d85d0ca84382084a69093 17.1s
=> => extracting sha256:8a3069484c0d1b37d049a11df986a5701ea6ef427bade131c73dd5c7e6038905 22.0s
=> => extracting sha256:257411b393455c190751fb43c658b4d3523d412721bda019e275ff8b6ab2ef05 0.0s
=> => extracting sha256:b1eb54da10569d3bfdc4b376a0324b4d89e69ce0ebe4245ac788679a7ce9f894 0.0s
=> => extracting sha256:467749c910c8837ed3e728f68d032be5b9aa90e748f2301a5df20e68b5b9f46b 57.0s
=> [stage-1 2/3] RUN apk update && apk add libstdc++ 7.0s
=> [graalvm 2/5] RUN gu install native-image 14.9s
=> [graalvm 3/5] COPY . /home/app/aawp-rest 0.6s
=> [graalvm 4/5] WORKDIR /home/app/aawp-rest 0.1s
=> [graalvm 5/5] RUN native-image -cp target/aawp-rest-*.jar 200.8s
=> [stage-1 3/3] COPY --from=graalvm /home/app/aawp-rest/aawp-rest /app/aawp-rest 0.3s
=> exporting to image 0.4s
=> => exporting layers 0.4s
=> => writing image sha256:270284f6eea95a9cc33f20cc36161a76da76aed56e16aa78ccc022bafc3f3886 0.0s
=> => naming to docker.io/library/aawp-rest:m1 0.0s
d:\Eclatian\Code\aawp\AppAdminWebAppRoot\facade\aawp-rest>docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
aawp-rest m1 270284f6eea9 8 seconds ago 25.9MB
d:\Eclatian\Code\aawp\AppAdminWebAppRoot\facade\aawp-rest>docker run -p 8080:8080 270284f6eea9
Error: No bin/java and no environment variable JAVA_HOME
Also, while building docker image, this warning comes up:
=> [graalvm 5/5] RUN native-image -cp target/aawp-rest-*.jar 57.4s
=> => # [aawp-rest:23] (cap): 1,559.75 ms, 1.14 GB
=> => # [aawp-rest:23] setup: 7,595.90 ms, 1.52 GB
=> => # [aawp-rest:23] (clinit): 570.63 ms, 1.52 GB
=> => # [aawp-rest:23] analysis: 24,801.19 ms, 1.52 GB
=> => # Warning: Aborting stand-alone image build due to unsupported features
=> => # Warning: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
While building the docker image on Ubuntu, this warning comes:
Warning: Image 'aawp-rest' is a fallback image that requires a JDK for execution (use --no-fallback to suppress fallback image generation and to print more detailed information why a fallback image was nec
essary).
Expected Behaviour
Docker image should run and application should be accessible.
Actual Behaviour
It asks for JAVA_HOME. GraalVM is creating a fall back native image it seems.
Error is :
D:\Eclatian\Code\micronautsample>docker run -p 8080:8080 aawp-rest:m1
Error: No bin/java and no environment variable JAVA_HOME
Environment Information
Example Application
The text was updated successfully, but these errors were encountered: