-
Notifications
You must be signed in to change notification settings - Fork 66
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
Maven build error with Graal VM on Spring Content #1657
Comments
Hi @AkshathSai, Any chance you have a project that shows the problem? |
Hi Paul, thx for considering this issue. You may use this attached stripped down sample replica project, the command used for native image compilation "mvn -Pnative native:compile" |
Thanks. That's helpful. I took a look at this and the compilation error is spring-aot generated code which is obviously to do with producing the native image. Probably not adding much value by stating that alone. As I understand it native images operate with a "closed world" principle where, in Spring terms, all beans need to be known ahead of time during compilation. Spring in general and by implication Spring Data and Spring Content rely heavily on runtime reflection to generate proxy classes that act as the implementation for your Digging into Spring Data I can see that they have added a bunch AotProcessor classes like this one for example. I am 99% sure are there to help the Spring Aot Processor generate the right BeanDefinition classes for an application. Spring Content does not have any of these yet and therefore we can probably be reasonably confident in sayng that Spring Content does not yet support Spring Native. At this point I don't have the first clue what those Spring Data Aot Processor classes are doing. I can guess but that about it. So I'll need to really dig into those and try and understand them as best I can. Then see if I can replicate that behavior in Spring Content. But that might take a while I am afraid. |
Thank you for the detailed explanation. It's clear that the issue I'm facing is due to the absence of AotProcessor classes in Spring Content, which are essential for Spring AOT to generate the right BeanDefinition classes for an application. Your insight that Spring Content doesn't support Spring Native yet is enlightening. I understand the "closed world" principle of native images. Indeed, Spring, and by extension, Spring Data and Spring Content, heavily rely on runtime reflection to generate proxy classes that act as the implementation for repositories and stores. The lack of support for this in Spring Content when using Spring Native is the root of the problem. I appreciate your willingness to dive deeper into the Spring Data AotProcessor classes despite your unfamiliarity with them. Your commitment to understand these classes and try to replicate their behavior in Spring Content is commendable. I understand that this process might take some time. I thank you in advance for your efforts and look forward to updates on this issue. In the meantime, I will continue to play around in my project and keep track of updates on Spring Native's support for Spring Content. Once again, thank you for your assistance and the time you've dedicated for considering this issue. |
Hey Paul, I just saw this medium article: https://medium.com/graalvm/enhancing-3rd-party-library-support-in-graalvm-native-image-with-shared-metadata-9eeae1651da4 Apparently, we can mostly get away without coding anything specific for native image support by using this fantastic Tracing Agent: https://www.graalvm.org/latest/reference-manual/native-image/metadata/AutomaticMetadataCollection/ In order to build native images we just need to supply the reachability metadata to the Graal VM and if we start any sample app that's using Spring Content using this sample reference command
and invoke the library code by watching videos (In my app case) it'll gather all the metadata in background & save it to the config-merge-dir specified here. We can filter our application specific code by applying java package names filters to collect only library specific metadata (like below in case of grade need to search for maven...)
and finally create PR in this repo https://github.com/oracle/graalvm-reachability-metadata/tree/master for automatically building native images using the build native image command leveraging our reachability-metadata. Here's the link for a sample app jar you may use for doing this: https://github.com/AkshathSai/StreamSpace/releases/tag/test Download the jar and paste some sample video clip in /Users/<your_userfolder>/Movies or /Users/<your_userfolder>/Downloads folder if you use MacOS or /<YOUR_USER_HOME>/Videos folder if you use Windows machine
Click on the personal media tab in the UI and you'll see the name of the video clip you've kept in your folder Finally, Gracefully shut down the JAR by using control + c on your keyboard and go to the 'config-merge-dir' you've specified in the cmd for the readability metadata JSON files. Hope this helps! |
Hi There,
When attempting to build my project using Graal VM, I encountered an error. I'm not sure if Spring Content supports Graal VM, but I'm raising this issue in case it's a bug or if support could be added.
Expected Result:
Successful build using either of the following commands:
or
Actual Result:
Maven build fails with the following error (stack trace below).
Steps to Reproduce:
mvn -Pnative native:compile
ormvn clean package -Pnative
The text was updated successfully, but these errors were encountered: