Repository: quarkusio/quarkus
Issue: Native build with quarkus-jdbc-oracle + quarkus-jdbc-db2 extension dependencies fails

### Describe the bug

Usage of the JDBC Driver extension for Oracle is causing the native build to fail when used together with the JDBC Driver extension for DB2 as following:

```
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM 21.3.0 Java 17 CE (Java Version 17.0.1+12-jvmci-21.3-b05)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] /mnt/c/Develop/graalvm-17-linux/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-DQuarkusWithJcc=true -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-Duser.language=en -J-Duser.country= -J-Dfile.encoding=UTF-8 -H:-ParseOnce -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -J-Djava.awt.headless=true -H:FallbackThreshold=0 --allow-incomplete-classpath -H:+ReportExceptionStackTraces -H:+AddAllCharsets -H:EnableURLProtocols=http,https -H:NativeLinkerOption=-no-pie -H:-UseServiceLoaderFeature -H:+StackTrace -J--add-exports=java.base/sun.security.action=ALL-UNNAMED --exclude-config .*com\\.oracle\\.database\\.jdbc.* /META-INF/native-image/(?:native-image\\.properties|reflect-config\\.json) -J--add-exports=java.management/sun.management=ALL-UNNAMED code-with-quarkus-1.0.0-SNAPSHOT-runner -jar code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
[code-with-quarkus-1.0.0-SNAPSHOT-runner:1269]    classlist:   5,771.23 ms,  0.94 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:1269]        (cap):   4,138.60 ms,  0.93 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:1269]        setup:   8,837.75 ms,  0.94 GB
The bundle named: com/sun/rowset/RowSetResourceBundle, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
00:45:15,392 INFO  [org.jbo.threads] JBoss Threads version 3.4.2.Final
To see how the classes got initialized, use --trace-class-initialization=oracle.jdbc.driver.OracleDriver,oracle.jdbc.OracleDriver
[code-with-quarkus-1.0.0-SNAPSHOT-runner:1269]     analysis:  56,966.08 ms,  5.26 GB
Error: Classes that should be initialized at run time got initialized during image building:
 oracle.jdbc.driver.OracleDriver the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis with 'OracleDriver.class'). To see why oracle.jdbc.driver.OracleDriver got initialized use --trace-class-initialization=oracle.jdbc.driver.OracleDriver
oracle.jdbc.OracleDriver the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis with 'OracleDriver.class' and subtype of oracle.jdbc.driver.OracleDriver). To see why oracle.jdbc.OracleDriver got initialized use --trace-class-initialization=oracle.jdbc.OracleDriver

com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
 oracle.jdbc.driver.OracleDriver the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis with 'OracleDriver.class'). To see why oracle.jdbc.driver.OracleDriver got initialized use --trace-class-initialization=oracle.jdbc.driver.OracleDriver
oracle.jdbc.OracleDriver the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis with 'OracleDriver.class' and subtype of oracle.jdbc.driver.OracleDriver). To see why oracle.jdbc.OracleDriver got initialized use --trace-class-initialization=oracle.jdbc.OracleDriver

        at com.oracle.svm.core.util.UserError.abort(UserError.java:73)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.checkDelayedInitialization(ConfigurableClassInitialization.java:555)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.duringAnalysis(ClassInitializationFeature.java:168)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$12(NativeImageGenerator.java:727)
        at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:73)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:727)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:529)
        at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:488)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:569)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:122)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:599)
[code-with-quarkus-1.0.0-SNAPSHOT-runner:1269]      [total]:  72,514.57 ms,  5.26 GB
# Printing build artifacts to: /mnt/c/Develop/workspace/code-with-quarkus/target/code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar/code-with-quarkus-1.0.0-SNAPSHOT-runner.build_artifacts.txt
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:00 min
[INFO] Finished at: 2022-01-23T00:45:51+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.6.3.Final:build (default) on project code-with-quarkus: 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:250)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:887)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:833)
[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:386)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:229)
[ERROR]         ... 11 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
```

### Expected behavior

I expect to be able to build natively using both extensions by the same application.

### Actual behavior

The native build is failing.

### How to Reproduce?

- Clone https://github.com/bvahdat/code-with-quarkus2
- Run `./mvnw package -Pnative`

### Output of `uname -a` or `ver`

Linux XYZ 4.4.0-18362-Microsoft #1801-Microsoft Sat Sep 11 15:28:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux

### Output of `java -version`

openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05) OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05, mixed mode, sharing)

### GraalVM version (if different from Java)

_No response_

### Quarkus version or git rev

2.6.3.Final

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

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)

### Additional information

_No response_

Changed files:
extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java

diff --git a/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java b/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java
index 4717048d953..87376ec0425 100644
--- a/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java
+++ b/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java
@@ -67,8 +67,12 @@ void build(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
     @BuildStep
     void runtimeInitializeDriver(BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitialized) {
         //These re-implement all the "--initialize-at-build-time" arguments found in the native-image.properties :
-        runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.OracleDriver"));
-        runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.driver.OracleDriver"));
+
+        // Override: the original metadata marks the drivers as "runtime initialized" but this makes it incompatible with
+        // other systems (e.g. DB2 drivers) as it makes them incompatible with the JDK DriverManager integrations:
+        // the DriverManager will typically (and most likely) need to load all drivers in a different phase.
+        // runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.OracleDriver"));
+        // runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.driver.OracleDriver"));
 
         // The Oracle driver's metadata hints to require java.sql.DriverManager to be initialized at runtime, but:
         //  A) I disagree with the fact that a driver makes changes outside of its scope (java.sql in this case)