Closed KaeYan93 closed 1 year ago
You should follow the recommendation in the error message and use --trace-class-initialization
to determine why some Bouncycastle types have been initialized at build time. Spring Boot does not provide any support for Bouncycastle so I believe that this initialization is out of our control. If that turns out not to be the case, we can re-open this issue and take another look.
Hi, thanks for the prompt reply. I followed your suggestion to trace class initialization. Seems like all of the initialization is caused by the same following error. Can you help me with this to understand why and how it might happen? Thanks
org.bouncycastle.jcajce.provider.symmetric.Threefish$Mappings was unintentionally initialized at build time. sun.nio.ch.UnixDomainSockets caused initialization of this class with the following trace:
at org.bouncycastle.jcajce.provider.symmetric.Threefish$Mappings.<clinit>(Unknown Source)
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Unknown Source)
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.java:128)
at jdk.internal.reflect.ReflectionFactory.newInstance(ReflectionFactory.java:347)
at java.lang.Class.newInstance(Class.java:645)
at org.bouncycastle.jce.provider.BouncyCastleProvider.loadServiceClass(BouncyCastleProvider.java:339)
at org.bouncycastle.jce.provider.BouncyCastleProvider.loadAlgorithms(BouncyCastleProvider.java:319)
at org.bouncycastle.jce.provider.BouncyCastleProvider.setup(BouncyCastleProvider.java:190)
at org.bouncycastle.jce.provider.BouncyCastleProvider.access$000(BouncyCastleProvider.java:72)
at org.bouncycastle.jce.provider.BouncyCastleProvider$1.run(BouncyCastleProvider.java:176)
at java.security.AccessController.executePrivileged(AccessController.java:776)
at java.security.AccessController.doPrivileged(AccessController.java:318)
at org.bouncycastle.jce.provider.BouncyCastleProvider.<init>(BouncyCastleProvider.java:172)
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Unknown Source)
at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:789)
at java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729)
at java.util.ServiceLoader$3.next(ServiceLoader.java:1403)
at sun.security.jca.ProviderConfig$ProviderLoader.load(ProviderConfig.java:347)
at sun.security.jca.ProviderConfig$3.run(ProviderConfig.java:254)
at sun.security.jca.ProviderConfig$3.run(ProviderConfig.java:248)
at java.security.AccessController.executePrivileged(AccessController.java:776)
at java.security.AccessController.doPrivileged(AccessController.java:318)
at sun.security.jca.ProviderConfig.doLoadProvider(ProviderConfig.java:248)
at sun.security.jca.ProviderConfig.getProvider(ProviderConfig.java:226)
at sun.security.jca.ProviderList.getProvider(ProviderList.java:268)
at sun.security.jca.ProviderList.getService(ProviderList.java:381)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:157)
at java.security.SecureRandom.getInstance(SecureRandom.java:387)
at sun.nio.ch.UnixDomainSockets.getRandom(UnixDomainSockets.java:118)
at sun.nio.ch.UnixDomainSockets.<clinit>(UnixDomainSockets.java:124)
You either need to prevent UnixDomainSockets
from being loaded or you need to allow the Bouncycastle class to be initialized at build time using --initialize-at-build-time
. This isn't the right place to get help with general GraalVM problems. If you have any further questions, please follow up with the GraalVM community instead.
Hi,
I failed to build spring native image with a spring boot project.
Spring boot version: 3.0.1 Command to build:
mvnw native:compile -Pnative
Maven plugin config:The error is as shown below: