question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Native build fails with postgres and oracle drivers together

See original GitHub issue

Describe the bug

I have added the following dependencies :

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

The native build fails.

It works with postgres alone, or oracle alone, but not with both together.

It means I cannot build an application, which may target postgres and/or oracle.

Expected behavior

Able to build the native image with both drivers postgres and oracle in the same executable.

Actual behavior

The build fails with:

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM 21.1.0 Java 11 CE (Java Version 11.0.11+8-jvmci-21.1-b05)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] /home/sevel/graalvm-ce-java11-21.1.0/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -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=3 -J-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true -J-Duser.language=en -J-Duser.country=US -J-Dfile.encoding=UTF-8 --allow-incomplete-classpath -J-Djava.io.tmpdir=/home/sevel/tmpdir -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -jar OrderProposal-2.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -J-Xmx10g -H:-AddAllCharsets -H:EnableURLProtocols=http,https -H:-UseServiceLoaderFeature -H:+StackTrace OrderProposal-2.0.0-SNAPSHOT-runner
[OrderProposal-2.0.0-SNAPSHOT-runner:4115]    classlist:   8,410.22 ms,  1.50 GB
[OrderProposal-2.0.0-SNAPSHOT-runner:4115]        (cap):     758.97 ms,  1.50 GB
WARNING: Method java.sql.SQLXML.<init>() not found.
[OrderProposal-2.0.0-SNAPSHOT-runner:4115]        setup:   3,522.08 ms,  1.50 GB
11:21:57,485 INFO  [org.hib.val.int.uti.Version] HV000001: Hibernate Validator 6.2.0.Final
11:21:57,598 INFO  [org.hib.Version] HHH000412: Hibernate ORM core version 5.5.4.Final
11:21:57,606 INFO  [org.hib.ann.com.Version] HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
11:21:57,649 INFO  [org.hib.dia.Dialect] HHH000400: Using dialect: org.hibernate.dialect.Oracle12cDialect
11:21:58,162 INFO  [org.jbo.res.res.i18n] RESTEASY002225: Deploying javax.ws.rs.core.Application: class com.lodh.gestion.orderproposal.infrastructure.JaxRsActivator
To see how the classes got initialized, use --trace-class-initialization=java.sql.DriverManager
[OrderProposal-2.0.0-SNAPSHOT-runner:4115]     analysis:  20,235.47 ms,  2.74 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 jar:file:///export/soft/appl/quarkus-order-proposal/OrderProposal/target/OrderProposal-2.0.0-SNAPSHOT-native-image-source-jar/lib/com.oracle.database.jdbc.ojdbc8-21.1.0.0.jar!/META-INF/native-image/native-image.properties). 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 jar:file:///export/soft/appl/quarkus-order-proposal/OrderProposal/target/OrderProposal-2.0.0-SNAPSHOT-native-image-source-jar/lib/com.oracle.database.jdbc.ojdbc8-21.1.0.0.jar!/META-INF/native-image/native-image.properties). 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:545)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.duringAnalysis(ClassInitializationFeature.java:228)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$14(NativeImageGenerator.java:765)
        at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:71)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:765)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:582)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$2(NativeImageGenerator.java:495)
        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

How to Reproduce?

Add both dependencies on an application, and build a native image.

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

GraalVM 21.1.0 Java 11 CE (Java Version 11.0.11+8-jvmci-21.1-b05)

Quarkus version or git rev

2.1.0

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
Sannecommented, Dec 15, 2021

Fixed it 😃

1reaction
vsevelcommented, Jul 28, 2021

hi @Sanne no hurry for me. And we have started running tests with oracle xe instead of postgres. I just wanted to create the issue if this was not known already.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrate Oracle native functions to PostgreSQL using extensions
Migrate Amazon RDS for Oracle to Amazon RDS for PostgreSQL using the aws_oracle_ext and orafce extensions with AWS SCT.
Read more >
Cannot Connect To PostgreSQL ODBC - Oracle Support
The pg_hba. conf was configured for the user enforces ssl based connection and that is why it was failing to connect. Currently it...
Read more >
2. Installation and Configuration - HammerDB
You should have the Oracle database software installed and a test database ... Db2 however both ODBC and CLI drivers are packaged together...
Read more >
How to Fix java.lang.classnotfoundexception oracle.jdbc ...
forName0(Native Method) at java.lang. ... In 99% cases this error is solved by putting right Oracle driver JAR into classpath, but if you...
Read more >
PostgreSQL Connector - Tableau Help
This article describes how to connect Tableau to a PostgreSQL database and set up the ... A new JDBC driver for PostgreSQL supports...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found