-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Providers loaded by FileSystemProvider not handled correctly in native image #5134
Comments
@vjovanov will look into that, but can't promise we can resolve this by the end of the week (for GraalVM-22.3). |
Hi guys, I'm facing the same issue. Do you have any news on this? Can I help with something? |
This requires moving FileSystemProviders to runtime. I tried making this change and many things failed because of the initialization strategy we use. I would wait for the new initialization strategy before addressing this issue. |
Thanks, @vjovanov. What would the timeline be for this? |
I'm hitting this too. It's annoying because the FS provider is brought in via transitive dependencies. |
I'd also be interested in any news about the issue. |
We are in need of the fix for this issue, this is the only blocker we have for graalvm native build |
FYI, in case of
|
I also need a fix for this bug - blocker |
When will it be repaired? |
Would setting up the |
@vjovanov - have tried that, but got a different issue then:
Is there a way to specify FileSystemProviders to add? |
This looks like a message from older versions of GraalVM. Have you tried with the latest dev build, or with the GraalVM for JDK 21 with a flag |
That was from
|
I think we need to add the option |
That would be |
So, actually, after switching to this setup and fixing |
Hope this can be a workaround for everyone until this issue is fixed as a part of #7488. |
It does work, however, since it requires initialising |
Have you tried to reduce that list of initialized classes when the |
Thanks for the suggestion @vjovanov. With |
We will try to move security classes to run-time init in the future, but it is uncertain whether it will be possible. Until then this looks like a good solution. |
Impacted by this |
@OlgaMaciaszek maybe a stupid question, but where exactly args like graalvmNative {
binaries {
main {
buildArgs.add('-H:-AddAllFileSystemProviders')
buildArgs.add('--strict-image-heap')
}
}
}
``` |
@andreiyusupau It does work correctly in our sample setup: https://github.com/spring-projects/spring-aot-smoke-tests/blob/main/cloud/cloud-config-server/build.gradle. You need to make sure you have the right version of Graal (21 or higher). |
Providers loaded by
java.nio.file.spi.FileSystemProvider
(such asBouncyCastleProvider
orSftpFileSystemProvider
) cause native image compilation to fail withNo instances of xxx are allowed in the image heap as this class should be initialized at image runtime.
. However, adding--initialize-at-run-time=java.nio.file.spi.FileSystemProvider
to setup results inError: The class java.nio.file.spi.FileSystemProvider has already been initialized (from command line with 'java.nio.file.spi.FileSystemProvider'); it is too late to register java.nio.file.spi.FileSystemProvider for build-time initialization.
.You can use this demo branch as a sample.
Run with
./mvnw clean package -Pnative -DskipTests
.The text was updated successfully, but these errors were encountered: