This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
I'm having issues with building a native-image of a project that makes use of SecureRandom
native-image -jar example.jar --no-fallback --initialize-at-build-time --initialize-at-run-time=java.security.SecureRandom example
Stack trace:
Error: Classes that should be initialized at run time got initialized during image building:
java.security.SecureRandom the class was requested to be initialized at run time (from command line with 'java.security.SecureRandom'). com.sun.jndi.dns.DnsClient caused initialization of this class with the following trace:
at java.security.SecureRandom.<clinit>(SecureRandom.java:158)
at sun.security.jca.JCAUtil$CachedSecureRandomHolder.<clinit>(JCAUtil.java:65)
at sun.security.jca.JCAUtil.getSecureRandom(JCAUtil.java:77)
at com.sun.jndi.dns.DnsClient.<clinit>(DnsClient.java:86)
Is there a fix for this?
Version:
OpenJDK Runtime Environment GraalVM CE 17.0.7+7.1 (build 17.0.7+7-jvmci-23.0-b12)
OpenJDK 64-Bit Server VM GraalVM CE 17.0.7+7.1 (build 17.0.7+7-jvmci-23.0-b12, mixed mode, sharing)
Makes sense. Thank you!