0

I'm building a native Quarkus app with "-Dnative -Dquarkus.native.container-build=true" but after including the software.amazon.awssdk:secretsmanager:2.20.136 and the buddies it pulls in I get a

Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: io.netty.util.internal.logging.Log4J2Logger. This error is reported at image build time because class io.netty.util.internal.logging.Log4J2LoggerFactory is registered for linking at image build time by command line
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:521)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:515)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedType(SharedGraphBuilderPhase.java:407)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedNewInstance(SharedGraphBuilderPhase.java:263)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genNewInstance(BytecodeParser.java:4531)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genNewInstance(BytecodeParser.java:4524)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5334)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3406)
    ... 43 more

I saw a few similar reports but resolving those issues appear to be... non-trivial. Any pointers on this specific aws-sdk tree?

Update: adding quarkus-netty as suggested by @geoand yields another exception:

Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.apache.commons.logging.LogFactory. This error is reported at image build time because class org.apache.http.conn.util.PublicSuffixMatcherLoader is registered for linking at image build time by command line
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:521)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.reportUnresolvedElement(SharedGraphBuilderPhase.java:515)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedType(SharedGraphBuilderPhase.java:407)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedMethod(SharedGraphBuilderPhase.java:435)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.handleUnresolvedInvoke(SharedGraphBuilderPhase.java:338)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1680)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeStatic(BytecodeParser.java:1655)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5331)
    at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3406)
    ... 42 more

also adding commons-logging and log4j gives

Error: Detected an instance of Random/SplittableRandom class in the image heap...

Detailed message: Trace: Object was reached by trying to constant fold static field org.apache.http.impl.auth.NTLMEngineImpl.RND_GEN at org.apache.http.impl.auth.NTLMEngineImpl.access$000(NTLMEngineImpl.java:51) parsing method org.apache.http.impl.auth.NTLMEngineImpl.access$000(NTLMEngineImpl.java:51) reachable via the parsing context at static root method.(Unknown Source)

One would think that everyone doing SDK operations from a AWS lambda in Quarkus native would run into this(?)

Thanks in advance, Nik

Nicklas Karlsson
  • 317
  • 1
  • 4
  • 12
  • Can you try adding `quarkus-netty` to the application? – geoand Aug 31 '23 at 14:10
  • "Progress!" as we say in the business when it breaks in a new place ;-) Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.apache.commons.logging.LogFactory. This error is reported at image build time because class org.apache.http.conn.util.PublicSuffixMatcherLoader is registered for linking at image build time by command line – Nicklas Karlsson Aug 31 '23 at 18:19
  • Hm... Actually taking a step back, what exactly are you trying to use from the AWS SDK? – geoand Sep 01 '23 at 08:22
  • The secrets manager for accessing a secret based on an ARN passed in through the environment. Can be reproduced just by generating a Quarkus project from the lambda archetype and adding the 2.x security manager dependency and building it as native – Nicklas Karlsson Sep 01 '23 at 10:31
  • Doesn't [this](https://docs.quarkiverse.io/quarkus-amazon-services/dev/amazon-secretsmanager.html) extension already provide that capability? – geoand Sep 01 '23 at 11:46

0 Answers0