0

I am building an application using Quarkus 2.6.1 that will perform operations in AWS using the AWS SDK. Particularly, DynamoDB, using both standard DynamoDB calls, as well as DynamoDB Mapper for object mapping. The application works just great in JVM mode. However, when I attempt to build a native executable I get the following errors:

Error: Unsupported features in 2 methods
Detailed message:
Error: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected.  To see how this object got instantiated use --trace-object-instantiation=java.util.Random. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by 
    reading field com.amazonaws.retry.PredefinedBackoffStrategies$EqualJitterBackoffStrategy.random of
        constant com.amazonaws.retry.PredefinedBackoffStrategies$EqualJitterBackoffStrategy@2c620143 reached by 
    reading field com.amazonaws.retry.PredefinedBackoffStrategies$SDKDefaultBackoffStrategy.equalJitterBackoffStrategy of
        constant com.amazonaws.retry.PredefinedBackoffStrategies$SDKDefaultBackoffStrategy@689747af reached by 
    reading field com.amazonaws.retry.RetryPolicy.backoffStrategy of
        constant com.amazonaws.retry.RetryPolicy@7ba74380 reached by 
    reading field com.amazonaws.ClientConfiguration.DEFAULT_RETRY_POLICY
Error: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected.  To see how this object got instantiated use --trace-object-instantiation=java.util.Random. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by 
    reading field com.amazonaws.retry.PredefinedBackoffStrategies$FullJitterBackoffStrategy.random of
        constant com.amazonaws.retry.PredefinedBackoffStrategies$FullJitterBackoffStrategy@22c9268f reached by 
    reading field com.amazonaws.retry.PredefinedBackoffStrategies$SDKDefaultBackoffStrategy.fullJitterBackoffStrategy of
        constant com.amazonaws.retry.PredefinedBackoffStrategies$SDKDefaultBackoffStrategy@689747af reached by 
    reading field com.amazonaws.retry.RetryPolicy.backoffStrategy of
        constant com.amazonaws.retry.RetryPolicy@7ba74380 reached by 
    reading field com.amazonaws.ClientConfiguration.DEFAULT_RETRY_POLICY

com.oracle.svm.core.util.UserError$UserException: Unsupported features in 2 methods
Detailed message:
Error: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected.  To see how this object got instantiated use --trace-object-instantiation=java.util.Random. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by 
    reading field com.amazonaws.retry.PredefinedBackoffStrategies$EqualJitterBackoffStrategy.random of
        constant com.amazonaws.retry.PredefinedBackoffStrategies$EqualJitterBackoffStrategy@2c620143 reached by 
    reading field com.amazonaws.retry.PredefinedBackoffStrategies$SDKDefaultBackoffStrategy.equalJitterBackoffStrategy of
        constant com.amazonaws.retry.PredefinedBackoffStrategies$SDKDefaultBackoffStrategy@689747af reached by 
    reading field com.amazonaws.retry.RetryPolicy.backoffStrategy of
        constant com.amazonaws.retry.RetryPolicy@7ba74380 reached by 
    reading field com.amazonaws.ClientConfiguration.DEFAULT_RETRY_POLICY
Error: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected.  To see how this object got instantiated use --trace-object-instantiation=java.util.Random. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by 
    reading field com.amazonaws.retry.PredefinedBackoffStrategies$FullJitterBackoffStrategy.random of
        constant com.amazonaws.retry.PredefinedBackoffStrategies$FullJitterBackoffStrategy@22c9268f reached by 
    reading field com.amazonaws.retry.PredefinedBackoffStrategies$SDKDefaultBackoffStrategy.fullJitterBackoffStrategy of
        constant com.amazonaws.retry.PredefinedBackoffStrategies$SDKDefaultBackoffStrategy@689747af reached by 
    reading field com.amazonaws.retry.RetryPolicy.backoffStrategy of
        constant com.amazonaws.retry.RetryPolicy@7ba74380 reached by 
    reading field com.amazonaws.ClientConfiguration.DEFAULT_RETRY_POLICY

    at com.oracle.svm.core.util.UserError.abort(UserError.java:87)
    at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:233)
    at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:759)
    at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:529)
    at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:488)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:569)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:122)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:599)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported features in 2 methods
Detailed message:
Error: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected.  To see how this object got instantiated use --trace-object-instantiation=java.util.Random. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by 
    reading field com.amazonaws.retry.PredefinedBackoffStrategies$EqualJitterBackoffStrategy.random of
        constant com.amazonaws.retry.PredefinedBackoffStrategies$EqualJitterBackoffStrategy@2c620143 reached by 
    reading field com.amazonaws.retry.PredefinedBackoffStrategies$SDKDefaultBackoffStrategy.equalJitterBackoffStrategy of
        constant com.amazonaws.retry.PredefinedBackoffStrategies$SDKDefaultBackoffStrategy@689747af reached by 
    reading field com.amazonaws.retry.RetryPolicy.backoffStrategy of
        constant com.amazonaws.retry.RetryPolicy@7ba74380 reached by 
    reading field com.amazonaws.ClientConfiguration.DEFAULT_RETRY_POLICY
Error: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected.  To see how this object got instantiated use --trace-object-instantiation=java.util.Random. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Trace: Object was reached by 
    reading field com.amazonaws.retry.PredefinedBackoffStrategies$FullJitterBackoffStrategy.random of
        constant com.amazonaws.retry.PredefinedBackoffStrategies$FullJitterBackoffStrategy@22c9268f reached by 
    reading field com.amazonaws.retry.PredefinedBackoffStrategies$SDKDefaultBackoffStrategy.fullJitterBackoffStrategy of
        constant com.amazonaws.retry.PredefinedBackoffStrategies$SDKDefaultBackoffStrategy@689747af reached by 
    reading field com.amazonaws.retry.RetryPolicy.backoffStrategy of
        constant com.amazonaws.retry.RetryPolicy@7ba74380 reached by 
    reading field com.amazonaws.ClientConfiguration.DEFAULT_RETRY_POLICY

    at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:129)
    at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:756)
    ... 6 more

I am building using Quarkus 2.6.1, OpenJDK 11.0.7, and GraalVM 21.3.0 Java 11 CE on macOS 12.1. Is there something I'm missing? Are there additional settings or compiler flags that I need to include to support this?

Shadowman
  • 11,150
  • 19
  • 100
  • 198

1 Answers1

0

For me the problem was related to the DynamoDB maven lib I was using.

I used:

    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-aws2-ddb</artifactId>
    </dependency>

But everything was solved when I changed it to:

    <dependency>
      <groupId>org.apache.camel.quarkus</groupId>
      <artifactId>camel-quarkus-aws2-ddb</artifactId>
    </dependency>
Edenshaw
  • 1,692
  • 18
  • 27