Bug Report for Spring Boot 3 Native I'm not sure if this is a bug or lack of documentation? (I couldn't find anything on how to solve this issue). Having a simple spring boot application (generated on start.spring.io), building the native image is failing due to missing dependencies; kotlinx-serialization and remotetools. Adding the following dependencies would resolve the issue:
runtimeOnly("org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1")
runtimeOnly("com.rometools:rome:1.18.0")
The exact error messages are (sometimes it's complaining about another class):
java.lang.TypeNotPresentException: Type com.rometools.rome.feed.WireFeed not present
java.lang.TypeNotPresentException: Type kotlinx.serialization.BinaryFormat not present
If I'm not mistaken having --allow-incomplete-classpath should help with this (please correct me if I'm wrong). But firstly I don't know how to do it (where to add the switch) and secondly is this really the right solution? Thanks.
Comment From: wilkinsona
What version of GraalVM are you using? We require 22.3 and have seen obscure Kotlin-related error messages with 22.2.
Comment From: akefirad
Ah good point, should have mentioned it. I was using 22.2.r17-nik (following this). Its 22.3 version seems to be "Early Access" (22.3.r17.ea-nik, right?). Anyway, tried with GraalVM 22.3.r19-grl and it seems to work. Thanks.
Comment From: eugeniace
Reproduced using GraalVM 22.3.0:
java.lang.TypeNotPresentException: Type com.rometools.rome.feed.WireFeed not present
java -version openjdk version "17.0.5" 2022-10-18 OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08) OpenJDK 64-Bit Server VM GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08, mixed mode, sharing)
native-image --version GraalVM 22.3.0 Java 17 CE (Java Version 17.0.5+8-jvmci-22.3-b08)
Comment From: wilkinsona
Sounds like you have a different problem, @eugeniace. @akefirad confirmed above that upgrading to 22.3 fixed their problem. If you would like us to investigate, please open a new issue providing a minimal sample that reproduces the problem that you're seeing.
Comment From: eugeniace
Should I check anything else beside the commands from above? I have installed on my Windows laptop also older versions of GraalVM or Liberica.
Comment From: wilkinsona
Those versions look fine to me. As I said above, if you would like us to investigate, please open a new issue providing a minimal sample that reproduces the problem that you're seeing.
Comment From: ddobrin
I can reproduce this on a Mac (Intel and M1) and Linux with GraalVM 22.3 as well, using Boot 3.0.1 Boot 3.0.0.-M5 did not require the addition of the above mentioned dependencies
Comment From: philwebb
@ddobrin Can you please provide a sample application if you have one that shows the problem.
Comment From: ddobrin
@philwebb : The repro is here: https://github.com/ddobrin/serverless-photosharing-workshop/tree/master/services/image-analysis/java Updated it to Boot 3.0.2 first, GraalVM remains 22.3, and the issue can be reproduced on an M1 Mac and a Linux box.
openjdk version "17.0.5" 2022-10-18 OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08) OpenJDK 64-Bit Server VM GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08, mixed mode, sharing)
The service uses Google Native Java Client Libraries and accesses Vision and Firestore; uses the latest Google BOM.
Native image builds and works fine when adding rometools & kotlinx:
Without the added dependencies, it can be built with the Java agent, collect the generated .json files, copy them to src/main/resources/META-INF and build the native image, which will fail with: [6/7] Compiling methods... [*] (65.0s @ 6.35GB)
Fatal error: java.lang.NullPointerException: Cannot invoke "jdk.vm.ci.meta.JavaField.format(String)" because "field" is null at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.meta.HostedUniverse.lookup(HostedUniverse.java:369) at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.meta.HostedUniverse.lookup(HostedUniverse.java:282)
These dependency requirements did not exist in Boot 3 M5, however libraries have evolved since.
Comment From: wilkinsona
Thanks for the repro, @ddobrin. I can reproduce this on an Intel Mac too. It looks to be the same problem as https://github.com/oracle/graal/issues/5318 which was fixed in Graal 22.3. Can you please open a Graal issue so that they can investigate? If you comment here with a link to it, we can keep an eye on it and provide any input that may be needed from our side.
Comment From: ddobrin
Thank you @wilkinsona.
Created a new issue in Graal, linked the old issue and this one, provided the repro.
New issue: Reopen Graal issue #5318 - not fixed in 22.3 or 23.0 dev
Comment From: wilkinsona
Thanks, @ddobrin. I've subscribed to the Graal issue. I'll close this one for now but we can re-open it if the Graal team discover that there are some changes to make on the Boot side of things.