-
Notifications
You must be signed in to change notification settings - Fork 113
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 native-image fails with minimum configuration #235
Comments
+1 I'm facing the exact same issue |
Thanks for raising this and for putting together a demo project for me to test with - I'm also new to GraalVM and mostly learned what I know while debugging that last issue that you linked to! 😅 (I was surprised that I could even get something to go given that Groovy is very much in the 'not supported' list of GraalVM.) I'll give this a look when I get some time and hopefully your demo project reveals something new that I've missed 🤞 |
Had a look at this over the last few weekends and managed to get something going, and once I pared it all back to see what actually made a difference the solution came back to that I had this error while working on the linked issue as well, and was able to get around it by telling GraalVM to initialize those classes at build time anyway: https://github.com/ultraq/thymeleaf-layout-dialect/blob/1af5824e33f61923a7f5700f2c41ede885f35b62/thymeleaf-layout-dialect-benchmark/source/META-INF/native-image/nz.net.ultraq.thymeleaf/thymeleaf-layout-dialect-benchmark/native-image.properties So translating those to your setup, I made the following modifications to your Configure the <plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<configuration>
<buildArgs>
<arg>--initialize-at-build-time=com.sun.beans</arg>
<arg>--initialize-at-build-time=java.beans.Introspector</arg>
</buildArgs>
</configuration>
</plugin> And I also had to add I'm now wondering if I should include those args in the layout dialect bundle that gets uploaded (I do include a bunch of other stuff which I'm still on the fence about: https://github.com/ultraq/thymeleaf-layout-dialect/blob/1af5824e33f61923a7f5700f2c41ede885f35b62/thymeleaf-layout-dialect/source/META-INF/native-image/nz.net.ultraq.thymeleaf/thymeleaf-layout-dialect/native-image.properties The line with where the responsibility for all this lies is getting very fuzzy and feels like something that should be fixed once GraalVM provides proper Groovy support 🤔 |
Somehow I missed your update @ultraq I’ll definitely revisit this on my side too |
I'm very new to GraalVM, so I am hoping this is a simple fix, with some better understanding.
I was having issues with GraalVM and Groovy dependencies while using version
nz.net.ultraq.thymeleaf.thymeleaf-layout-dialect@3.2.0
, on step 7 - compilingI then found this issue - #232 - which alerted me to the existence of
3.2.1
However, this doesnt actually allow this lib to be used in a project that wants to use GraalVM.
Quite easy to reproduce, and I have pushed to a demo repository - https://github.com/shainegordon/thymleaf_layout_graalvm
This can be reproduced by running either
docker build -t thymleaf_layout_graalvm .
OR
./mvnw clean native:compile -Pnative
This is a minimal project, created at https://start.spring.io/, with only "Web" and "Native" added. Kotlin, Maven, Java 17, Spring boot 3.0.5.
DemoApplication.kt
pom.xml
This will basically produce the following output/error
If we include
--trace-class-initialization=java.beans.Introspector
(by manually running thenative-image
command that maven will echo), then we get the following:At this point I am stuck, as I dont know enough about GraalVM to debug this.
It is also possible that this library cannot actually work with Spring Boot & GraalVM, as Groovy does not seem to be supported as per https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-with-GraalVM#general
The text was updated successfully, but these errors were encountered: