4

I'm trying to run Spring Boot application using GraalVM Native. After successful compilation into single file, I can easily run binary, Spring Boot starts normally, but when I trying to run it inside docker with ubuntu image (it not contains java, but simple HelloWorld in GraalVM native works without JRE) I getting this error:

Error: No bin/java and no environment variable JAVA_HOME

I've read that I probably need to init classes at runtime instead of compile time (from: Problem with creating AWS Lambda function using Micronaut and GraalVM). But I don't know which classes should I pass to --delay-class-initialization-to-runtime. How can I run my Spring Boot app without JRE?

  • How/where did you compile your Spring app into Graal Native Image? The Docker container's base image (`FROM baseimageName` - in your case `ubuntu`) needs to *match exactly* the base image or machine your app was compiled on, since the process creates an 100% machine specific (native) compiled executable. The easiest way to run your app inside a Docker container, is to build it inside the same container (or at least the same base image) - see this [Dockerfile](https://github.com/jonashackt/spring-boot-graalvm/blob/master/Dockerfile) as an example. – jonashackt May 11 '20 at 15:08
  • 4
    You need to pass graalvm `--no-fallback` arg to build a entirely standalone executable – deFreitas Aug 08 '20 at 04:48

0 Answers0