Uploaded image for project: 'Red Hat Fuse'
  1. Red Hat Fuse
  2. ENTESB-16565

Quarkus Native: SQS to Mongo fails to compile with NoClassDefFoundError: jnr/unixsocket/UnixSocket

XMLWordPrintable

    • False
    • False
    • % %
    • Undefined

      quarkus version: 1.13.0
      camel quarkus version: 1.8.0

      Having the integration from sqs to mongodb, it fails to compile to native with:

      [INFO] Scanning for projects...
      [INFO] 
      [INFO] -----------------------< com.test:sqs-to-mongo >------------------------
      [INFO] Building sqs-to-mongo 1.0.0-SNAPSHOT
      [INFO] --------------------------------[ jar ]---------------------------------
      [INFO] 
      [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ sqs-to-mongo ---
      [INFO] 
      [INFO] --- quarkus-maven-plugin:1.13.0.Final:generate-code (default) @ sqs-to-mongo ---
      [INFO] 
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ sqs-to-mongo ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 2 resources
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ sqs-to-mongo ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 1 source file to /git/tnb-tests/target/sqs-to-mongo/target/classes
      [INFO] 
      [INFO] --- quarkus-maven-plugin:1.13.0.Final:generate-code-tests (default) @ sqs-to-mongo ---
      [INFO] 
      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ sqs-to-mongo ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory /git/tnb-tests/target/sqs-to-mongo/src/test/resources
      [INFO] 
      [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ sqs-to-mongo ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 2 source files to /git/tnb-tests/target/sqs-to-mongo/target/test-classes
      [INFO] 
      [INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ sqs-to-mongo ---
      [INFO] Tests are skipped.
      [INFO] 
      [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ sqs-to-mongo ---
      [INFO] Building jar: /git/tnb-tests/target/sqs-to-mongo/target/sqs-to-mongo-1.0.0-SNAPSHOT.jar
      [INFO] 
      [INFO] --- quarkus-maven-plugin:1.13.0.Final:build (default) @ sqs-to-mongo ---
      [INFO] [org.jboss.threads] JBoss Threads version 3.2.0.Final
      [INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /git/tnb-tests/target/sqs-to-mongo/target/sqs-to-mongo-1.0.0-SNAPSHOT-native-image-source-jar/sqs-to-mongo-1.0.0-SNAPSHOT-runner.jar
      [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /git/tnb-tests/target/sqs-to-mongo/target/sqs-to-mongo-1.0.0-SNAPSHOT-native-image-source-jar/sqs-to-mongo-1.0.0-SNAPSHOT-runner.jar
      [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildContainerRunner] Using docker to run the native image builder
      [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildContainerRunner] Checking image status quay.io/quarkus/ubi-quarkus-native-image:21.0.0-java11
      21.0.0-java11: Pulling from quarkus/ubi-quarkus-native-image
      Digest: sha256:becf08de869e707beaa5e57444b533ef93ebef15aad90c92ac660ddf7cea2b11
      Status: Image is up to date for quay.io/quarkus/ubi-quarkus-native-image:21.0.0-java11
      quay.io/quarkus/ubi-quarkus-native-image:21.0.0-java11
      [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 21.0.0 (Java Version 11.0.10+8-jvmci-21.0-b06)
      [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] docker run --env LANG=C --user 21798:21798 --rm -v /git/tnb-tests/target/sqs-to-mongo/target/sqs-to-mongo-1.0.0-SNAPSHOT-native-image-source-jar:/project:z quay.io/quarkus/ubi-quarkus-native-image:21.0.0-java11 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Duser.language=en -J-Duser.country=US -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -jar sqs-to-mongo-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services --no-server -H:-UseServiceLoaderFeature -H:+StackTrace sqs-to-mongo-1.0.0-SNAPSHOT-runner
      [sqs-to-mongo-1.0.0-SNAPSHOT-runner:27]    classlist:   1,280.49 ms,  1.18 GB
      [sqs-to-mongo-1.0.0-SNAPSHOT-runner:27]        setup:     365.37 ms,  1.18 GB
      Fatal error:java.lang.NoClassDefFoundError
      	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
      	at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603)
      	at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
      	at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:488)
      	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:370)
      	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:529)
      	at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:119)
      	at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:561)
      Caused by: java.lang.NoClassDefFoundError: jnr/unixsocket/UnixSocket
      	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
      	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3166)
      	at java.base/java.lang.Class.getDeclaredMethods(Class.java:2309)
      	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleDeletedClass(AnnotationSubstitutionProcessor.java:512)
      	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:305)
      	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:265)
      	at com.oracle.svm.hosted.NativeImageGenerator.createDeclarativeSubstitutionProcessor(NativeImageGenerator.java:929)
      	at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:863)
      	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:561)
      	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:476)
      	at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
      	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
      	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
      	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
      	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
      	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
      Caused by: java.lang.ClassNotFoundException: jnr.unixsocket.UnixSocket
      	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
      	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
      	... 16 more
      Error: Image build request failed with exit status 1
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD FAILURE
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  8.401 s
      [INFO] Finished at: 2021-05-26T19:40:36+02:00
      [INFO] ------------------------------------------------------------------------
      [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.13.0.Final:build (default) on project sqs-to-mongo: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
      [ERROR] 	[error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
      [ERROR] 	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:209)
      [ERROR] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [ERROR] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      [ERROR] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      [ERROR] 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      [ERROR] 	at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
      [ERROR] 	at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
      [ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
      [ERROR] 	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
      [ERROR] 	at java.base/java.lang.Thread.run(Thread.java:834)
      [ERROR] 	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
      [ERROR] Caused by: java.lang.RuntimeException: Image generation failed. Exit code: 1
      [ERROR] 	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:350)
      [ERROR] 	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:181)
      [ERROR] 	... 10 more
      [ERROR] -> [Help 1]
      [ERROR] 
      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
      [ERROR] Re-run Maven using the -X switch to enable full debug logging.
      [ERROR] 
      [ERROR] For more information about the errors and possible solutions, please read the following articles:
      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
      

      integration:

      package com.test;
      
      import org.apache.camel.builder.RouteBuilder;
      import javax.enterprise.context.ApplicationScoped;
      
      @ApplicationScoped()
      public class MyRouteBuilder extends RouteBuilder {
      
          @Override
          public void configure() throws Exception {
              from(from).to(to);
          }
      
          final String from = "aws2-sqs://<queue>?accessKey=RAW(<key>)&secretKey=RAW(<key>)&region=us-west-1";
      
          final String to = "mongodb://camelMongoClient?database=sampledb&collection=<collection>&operation=insert";
      }
      
      

      using mongodb or sqs in separate integrations without each other works OK in native

            jnethert@redhat.com James Netherton
            avano@redhat.com Andrej Vano
            Martin Muzikar Martin Muzikar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: