snowe
12/02/2023, 12:02 AMgraalvm
in the examples repo and just trying to compile that (I have already been trying with my own app for hours lol) and I’m getting the following error message:
0.0s
=> ERROR [graalvm 2/5] RUN gu install native-image 1.6s
------
> [graalvm 2/5] RUN gu install native-image:
0.565 Downloading: Release index file from <http://oca.opensource.oracle.com|oca.opensource.oracle.com>
1.513 Error: Error reading component list: <https://oca.opensource.oracle.com/gds/meta-data.json>
------
Dockerfile:2
--------------------
1 | FROM <http://ghcr.io/graalvm/graalvm-ce:java11-21.3.0|ghcr.io/graalvm/graalvm-ce:java11-21.3.0> as graalvm
2 | >>> RUN gu install native-image
3 |
4 | COPY . /home/app/http4k-example
--------------------
ERROR: failed to solve: process "/bin/sh -c gu install native-image" did not complete successfully: exit code: 3
I change the ce container to 22 and it gets further
FROM <http://ghcr.io/graalvm/graalvm-ce:22|ghcr.io/graalvm/graalvm-ce:22> as graalvm
but then I get java errors.
1.759 Fatal error: java.lang.UnsupportedClassVersionError: com/example/HelloWorldKt has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 61.0
so then I switch to java17 graalvm 22
❯ asdf local java graalvm-22.3.1+java17
that leads to
0.0s
=> [graalvm 3/5] COPY . /home/app/http4k-example 0.0s
=> [graalvm 4/5] WORKDIR /home/app/http4k-example 0.0s
=> [graalvm 5/5] RUN native-image --no-fallback --no-server -cp build/libs/Example-all.jar com.example.HelloWorldKt 35.4s
=> [stage-1 3/3] COPY --from=graalvm /home/app/http4k-example/com.example.helloworldkt /app/http4k-example 0.1s
=> exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:86d8a2b414461509200613c7d388f9a0e91a759f6e7b22d9f466a924e7053a29 0.0s
=> => naming to <http://docker.io/library/http4k-graal-example|docker.io/library/http4k-graal-example> 0.0s
What's Next?
1. Sign in to your Docker account → docker login
2. View a summary of image vulnerabilities and recommendations → docker scout quickview
Running http4k on GraalVM...
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
exec /app/http4k-example: no such file or directory
the amd64 thing shouldn’t be causing problems, so it seems like the copy --from=graalvm
is causing issues. Not sure what issues though.
But weirdly I am getting a completely different error in my project. This is already too long so I’ll paste that error in the thread.snowe
12/02/2023, 12:03 AM0.0s
=> CACHED [graalvm 4/5] WORKDIR /home/app/http4k-example 0.0s
=> ERROR [graalvm 5/5] RUN native-image --no-fallback --no-server -cp build/libs/projectname-1.0.0-SNAPSHOT.jar.jar com.sunrun.pricing.lambda.Http4kFnKt 1.5s
------
> [graalvm 5/5] RUN native-image --no-fallback --no-server -cp build/libs/projectname-1.0.0-SNAPSHOT.jar.jar com.sunrun.pricing.lambda.Http4kFnKt:
0.133 Warning: Ignoring server-mode native-image argument --no-server.
1.482 ========================================================================================================================
1.482 GraalVM Native Image: Generating 'com.sunrun.pricing.lambda.http4kfnkt' (executable)...
1.482 ========================================================================================================================
1.485 [1/7] Initializing... (0.0s @ 0.14GB)
1.486 Error: Main entry point class 'com.sunrun.pricing.lambda.Http4kFnKt' neither found on the classpath nor on the modulepath.
1.486 modulepath: '/opt/graalvm-ce-java17-22.3.3/lib/svm/library-support.jar'
1.487 Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
1.511 Error: Image build request failed with exit status 1
------
Dockerfile:7
--------------------
5 | WORKDIR /home/app/http4k-example
6 |
7 | >>> RUN native-image --no-fallback --no-server -cp build/libs/projectname-1.0.0-SNAPSHOT.jar.jar com.sunrun.pricing.lambda.Http4kFnKt
8 |
9 | FROM frolvlad/alpine-glibc
--------------------
ERROR: failed to solve: process "/bin/sh -c native-image --no-fallback --no-server -cp build/libs/projectname-1.0.0-SNAPSHOT.jar.jar com.sunrun.pricing.lambda.Http4kFnKt" did not complete successfully: exit code: 1
is the error I’m getting in my code.
FROM <http://ghcr.io/graalvm/graalvm-ce:22|ghcr.io/graalvm/graalvm-ce:22> as graalvm
RUN gu install native-image
COPY . /home/app/http4k-example
WORKDIR /home/app/http4k-example
RUN native-image --no-fallback --no-server -cp build/libs/projectname-1.0.0-SNAPSHOT.jar.jar com.sunrun.pricing.lambda.Http4kFnKt
FROM frolvlad/alpine-glibc
RUN apk update && apk add libstdc++
EXPOSE 8080
COPY --from=graalvm /home/app/http4k-example/com.sunrun.pricing.lambda.http4kfnkt /app/http4k-example
ENTRYPOINT ["/app/http4k-example"]
is my dockerfile. I’ve verified that the META-INF/manifest.mf
file is referencing the correct class. I’ve checked that the zip is there. I check that it’s named correctly. Not sure what the issue is here.dave
12/02/2023, 1:29 PMFROM ghcr.io/graalvm/native-image:21 as graalvm
... which builds the native image (but doesn't run on my M1 mac).dave
12/02/2023, 1:30 PMsnowe
12/04/2023, 5:15 PMRunning http4k on GraalVM...
exec /app/http4k-example: no such file or directory
when running ./build_and_run.sh
Here’s the full logsnowe
12/04/2023, 5:15 PMsnowe
12/04/2023, 5:16 PMdave
12/04/2023, 5:27 PMdave
12/04/2023, 5:27 PMsnowe
12/04/2023, 5:28 PMsnowe
12/04/2023, 5:29 PMdave
12/04/2023, 5:31 PMsnowe
12/04/2023, 5:31 PMsnowe
12/04/2023, 5:40 PMsnowe
12/04/2023, 5:47 PMsnowe
12/05/2023, 3:43 PMFROM <http://ghcr.io/graalvm/native-image-community:21|ghcr.io/graalvm/native-image-community:21> as graalvm
allowed the build to succeed and the code to run on m1snowe
12/05/2023, 3:44 PM--static
at line 6. not sure that’s needed. let me test withoutdave
12/05/2023, 3:45 PMsnowe
12/05/2023, 3:45 PMdave
12/05/2023, 5:41 PMFROM <http://ghcr.io/graalvm/native-image-community:21|ghcr.io/graalvm/native-image-community:21> as graalvm
COPY . /home/app/http4k-example
WORKDIR /home/app/http4k-example
RUN native-image --static --no-fallback -cp build/libs/example.jar com.example.HelloWorldKt
FROM frolvlad/alpine-glibc
EXPOSE 8080
COPY --from=graalvm /home/app/http4k-example/com.example.helloworldkt /app/http4k-example
ENTRYPOINT ["/app/http4k-example"]
dave
12/05/2023, 5:41 PMsnowe
12/05/2023, 5:41 PMsnowe
12/05/2023, 5:41 PMdave
12/05/2023, 5:42 PMsnowe
12/05/2023, 5:42 PMsnowe
12/05/2023, 9:55 PM