1

I am trying  funqy-amazon-lambda-http-quickstart at https://github.com/quarkusio/quarkus-quickstarts. I wanted to try XRay support and added

    <dependency>
        <groupId>io.quarkus</groupId>
        <artifactId>quarkus-amazon-lambda-xray</artifactId>
    </dependency> 

But getting errors like below when building project. I am sure there is some configuration I am missing. I tried searching docs at Quarkus but no success.

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] docker run -v /Users/jay/dev/java-lambda/quarkus-quickstarts/funqy-quickstarts/funqy-amazon-lambda-http-quickstart/target/funqy-amazon-lambda-http-quickstart-1.0-SNAPSHOT-native-image-source-jar:/project:z --env LANG=C --rm quay.io/quarkus/ubi-quarkus-native-image:20.1.0-java11 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Duser.language=en -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -H:+JNI -jar funqy-amazon-lambda-http-quickstart-1.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:-IncludeAllTimeZones -H:EnableURLProtocols=http --no-server -H:-UseServiceLoaderFeature -H:+StackTrace funqy-amazon-lambda-http-quickstart-1.0-SNAPSHOT-runner
-H:IncludeAllTimeZones and -H:IncludeTimeZones are now deprecated. Native-image includes all timezonesby default.
[funqy-amazon-lambda-http-quickstart-1.0-SNAPSHOT-runner:24]    classlist:   9,874.79 ms,  0.94 GB
[funqy-amazon-lambda-http-quickstart-1.0-SNAPSHOT-runner:24]        (cap):   1,127.41 ms,  0.94 GB
[funqy-amazon-lambda-http-quickstart-1.0-SNAPSHOT-runner:24]        setup:   3,086.63 ms,  0.94 GB
11:32:19,929 INFO  [org.jbo.threads] JBoss Threads version 3.1.1.Final
[funqy-amazon-lambda-http-quickstart-1.0-SNAPSHOT-runner:24]     (clinit):     796.70 ms,  1.11 GB
[funqy-amazon-lambda-http-quickstart-1.0-SNAPSHOT-runner:24]   (typeflow):  16,029.95 ms,  1.11 GB
[funqy-amazon-lambda-http-quickstart-1.0-SNAPSHOT-runner:24]    (objects):  25,406.30 ms,  1.11 GB
[funqy-amazon-lambda-http-quickstart-1.0-SNAPSHOT-runner:24]   (features):     698.70 ms,  1.11 GB
[funqy-amazon-lambda-http-quickstart-1.0-SNAPSHOT-runner:24]     analysis:  45,576.08 ms,  1.11 GB
Error: Unsupported features in 18 methods
Detailed message:
Error: Class initialization of com.amazonaws.xray.AWSXRayRecorderBuilder failed. Use the option --initialize-at-run-time=com.amazonaws.xray.AWSXRayRecorderBuilder to explicitly request delayed initialization of this class.
Original exception that caused the problem: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
        at com.amazonaws.xray.AWSXRayRecorderBuilder.<clinit>(AWSXRayRecorderBuilder.java:34)
        at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
        at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1042)
        at jdk.unsupported/sun.misc.Unsafe.ensureClassInitialized(Unsafe.java:698)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.ensureClassInitialized(ConfigurableClassInitialization.java:169)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.computeInitKindAndMaybeInitializeClass(ConfigurableClassInitialization.java:586)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.computeInitKindAndMaybeInitializeClass(ConfigurableClassInitialization.java:132)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.maybeInitializeHosted(ConfigurableClassInitialization.java:160)
        at com.oracle.svm.hosted.SVMHost.registerType(SVMHost.java:223)
        at com.oracle.graal.pointsto.meta.AnalysisUniverse.createType(AnalysisUniverse.java:264)
Jaydeep Patel
  • 2,394
  • 1
  • 21
  • 27

1 Answers1

2

The X-Ray SDK uses the Apache commons logging library to emit log messages. It takes this dependency transitively from the AWS SDK. I'm not familiar with the quarkus library, but the only reason that I can think of that would cause this error is if a pom.xml somewhere is explicitly excluding the Apache commons logging library from being pulled in transitively. The remedy that should work is to add the dependency to your classpath manually:

<dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.1.3</version>
</dependency>
William Armiros
  • 267
  • 1
  • 10