Skip to content
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

Spring Boot 3 Native Needs RomeTools and Kotlin Serialization JARs. #32915

Closed
akefirad opened this issue Oct 28, 2022 · 12 comments
Closed

Spring Boot 3 Native Needs RomeTools and Kotlin Serialization JARs. #32915

akefirad opened this issue Oct 28, 2022 · 12 comments
Labels
for: external-project For an external project and not something we can fix

Comments

@akefirad
Copy link

akefirad commented Oct 28, 2022

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 28, 2022
@wilkinsona
Copy link
Member

What version of GraalVM are you using? We require 22.3 and have seen obscure Kotlin-related error messages with 22.2.

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Oct 28, 2022
@akefirad
Copy link
Author

akefirad commented Oct 29, 2022

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.

@bclozel bclozel added status: invalid An issue that we don't feel is valid and removed status: waiting-for-feedback We need additional information before we can continue status: waiting-for-triage An issue we've not yet triaged labels Oct 29, 2022
@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Oct 29, 2022
@eugeniace
Copy link

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)

@wilkinsona
Copy link
Member

wilkinsona commented Nov 2, 2022

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.

@eugeniace
Copy link

Should I check anything else beside the commands from above? I have installed on my Windows laptop also older versions of GraalVM or Liberica.

@wilkinsona
Copy link
Member

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.

@ddobrin
Copy link

ddobrin commented Jan 18, 2023

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

@philwebb
Copy link
Member

@ddobrin Can you please provide a sample application if you have one that shows the problem.

@ddobrin
Copy link

ddobrin commented Jan 30, 2023

@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:
com.rometools
rome
...
org.jetbrains.kotlinx
kotlinx-serialization-core

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.

@philwebb philwebb reopened this Jan 30, 2023
@philwebb philwebb added status: waiting-for-triage An issue we've not yet triaged and removed status: invalid An issue that we don't feel is valid labels Jan 30, 2023
@wilkinsona
Copy link
Member

Thanks for the repro, @ddobrin. I can reproduce this on an Intel Mac too. It looks to be the same problem as oracle/graal#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.

@ddobrin
Copy link

ddobrin commented Feb 1, 2023

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

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Feb 1, 2023
@wilkinsona
Copy link
Member

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.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Feb 1, 2023
@wilkinsona wilkinsona removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Feb 1, 2023
@wilkinsona wilkinsona added the for: external-project For an external project and not something we can fix label Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

7 participants