Uploaded image for project: 'Quarkus'
  1. Quarkus
  2. QUARKUS-1305

Native build fails with Oracle and other JDBC drivers together

XMLWordPrintable

    • Hide

      Create an application with both extensions (see description) and invoke native build:

      mvn clean package -Pnative
      

      OR

      Use the attached reproducer:

      unzip oracle-reproducer.zip
      cd oracle-reproducer
      mvn clean package -Pnative -Dquarkus.platform.group-id=com.redhat.quarkus.platform -Dquarkus.platform.version=2.2.3.Final-redhat-00001 -Dmaven.repo.local=<path-to-repo>
      
      Show
      Create an application with both extensions (see description) and invoke native build: mvn clean package -Pnative OR Use the attached reproducer: unzip oracle-reproducer.zip cd oracle-reproducer mvn clean package -Pnative -Dquarkus.platform.group-id=com.redhat.quarkus.platform -Dquarkus.platform.version=2.2.3.Final-redhat-00001 -Dmaven.repo. local =<path-to-repo>
    • +

      When using Oracle together with other JDBC driver, e.g.:

      		<dependency>
      			<groupId>io.quarkus</groupId>
      			<artifactId>quarkus-jdbc-oracle</artifactId>
      		</dependency>
      		<dependency>
      			<groupId>io.quarkus</groupId>
      			<artifactId>quarkus-jdbc-postgresql</artifactId>
      		</dependency>
      
      

      then the native build fails with following error:

      [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] /home/jsmrcka/.sdkman/candidates/java/21.0.0.r11-grl/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Duser.language=en -J-Duser.country=US -J-Dfile.encoding=UTF-8 -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -H:FallbackThreshold=0 --allow-incomplete-classpath -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie -H:-UseServiceLoaderFeature -H:+StackTrace oracle-test-1.0.0-SNAPSHOT-runner -jar oracle-test-1.0.0-SNAPSHOT-runner.jar
      [oracle-test-1.0.0-SNAPSHOT-runner:98624]    classlist:   2,484.20 ms,  0.96 GB
      [oracle-test-1.0.0-SNAPSHOT-runner:98624]        (cap):     701.12 ms,  0.96 GB
      [oracle-test-1.0.0-SNAPSHOT-runner:98624]        setup:   2,673.65 ms,  0.96 GB
      11:10:40,745 INFO  [org.jbo.threads] JBoss Threads version 3.4.2.Final-redhat-00001
      To see how the classes got initialized, use --trace-class-initialization=java.sql.DriverManager
      [oracle-test-1.0.0-SNAPSHOT-runner:98624]     analysis:  18,803.77 ms,  2.28 GB
      Error: Classes that should be initialized at run time got initialized during image building:
       java.sql.DriverManager the class was requested to be initialized at run time (from the command line and from feature io.quarkus.runner.AutoFeature.beforeAnalysis). To see why java.sql.DriverManager got initialized use --trace-class-initialization=java.sql.DriverManager
      
      com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
       java.sql.DriverManager the class was requested to be initialized at run time (from the command line and from feature io.quarkus.runner.AutoFeature.beforeAnalysis). To see why java.sql.DriverManager got initialized use --trace-class-initialization=java.sql.DriverManager
      
      	at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
      	at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.checkDelayedInitialization(ConfigurableClassInitialization.java:539)
      	at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.duringAnalysis(ClassInitializationFeature.java:226)
      	at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$8(NativeImageGenerator.java:740)
      	at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70)
      	at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:740)
      	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:563)
      	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)
      Error: Image build request failed with exit status 1
      

            sgrinove Sanne Grinovero
            rhn-support-jsmrcka Josef Smrcka (Inactive)
            Pablo Gonzalez Granados Pablo Gonzalez Granados (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: