From 4f96382c2e0c2a4fa883beb23440c0bcb5644485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20K=C3=B6nig?= Date: Wed, 17 Jul 2024 12:14:06 +0200 Subject: [PATCH 1/6] [oracle-jdbc] Upgrade Oracle JDBC driver to 23.4.0.24.05 --- bom/application/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 28bcbfe8b791e..0a2f2868cfc4e 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -125,7 +125,7 @@ 8.3.0 12.6.3.jre11 1.6.7 - 23.3.0.23.09 + 23.4.0.24.05 10.16.1.1 11.5.8.0 1.2.6 From 19d9ed1b269cafa8045dcf2b8b3db2dc4c290b89 Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Thu, 18 Jul 2024 17:11:07 +0100 Subject: [PATCH 2/6] [oracle-jdbc] Remove unnecessary conditionals from @BuildSteps in the Oracle JDBC extension --- .../jdbc/oracle/deployment/ExtendedCharactersSupport.java | 3 +-- .../jdbc/oracle/deployment/OracleMetadataOverrides.java | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/ExtendedCharactersSupport.java b/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/ExtendedCharactersSupport.java index 875f8e1db2349..e01f0ee3f278a 100644 --- a/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/ExtendedCharactersSupport.java +++ b/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/ExtendedCharactersSupport.java @@ -5,13 +5,12 @@ import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.Record; import io.quarkus.deployment.pkg.NativeConfig; -import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild; import io.quarkus.jdbc.oracle.runtime.OracleInitRecorder; public final class ExtendedCharactersSupport { @Record(STATIC_INIT) - @BuildStep(onlyIf = NativeOrNativeSourcesBuild.class) + @BuildStep public void preinitializeCharacterSets(NativeConfig config, OracleInitRecorder recorder) { recorder.setupCharSets(config.addAllCharsets()); } 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 317dbd961716c..b6b13a7baadad 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 @@ -12,7 +12,6 @@ import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem; -import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild; import io.quarkus.maven.dependency.ArtifactKey; /** @@ -36,7 +35,7 @@ * require it, so this would facilitate the option to revert to the older version in * case of problems. */ -@BuildSteps(onlyIf = NativeOrNativeSourcesBuild.class) +@BuildSteps public final class OracleMetadataOverrides { static final String DRIVER_JAR_MATCH_REGEX = "com\\.oracle\\.database\\.jdbc"; From 4181c280f1c6e423fe2ee3898fdd0b7760ce09ec Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Thu, 18 Jul 2024 17:46:46 +0100 Subject: [PATCH 3/6] [oracle-jdbc] Allow the Oracle JDBC driver to load its custom NativeImageFeature --- .../quarkus/jdbc/oracle/deployment/OracleNativeImage.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleNativeImage.java b/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleNativeImage.java index 8167b900a952e..1ea683e1a37a5 100644 --- a/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleNativeImage.java +++ b/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleNativeImage.java @@ -3,6 +3,7 @@ import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.AdditionalIndexedClassesBuildItem; +import io.quarkus.deployment.builditem.NativeImageFeatureBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; /** @@ -10,6 +11,11 @@ */ public final class OracleNativeImage { + @BuildStep + NativeImageFeatureBuildItem staticNativeImageFeature() { + return new NativeImageFeatureBuildItem("oracle.jdbc.nativeimage.NativeImageFeature"); + } + /** * Registers the {@code oracle.jdbc.driver.OracleDriver} so that it can be loaded * by reflection, as commonly expected. From 1afa6710af47bf7871e147ab4ab58d5d0af6cc9e Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Thu, 18 Jul 2024 17:32:55 +0100 Subject: [PATCH 4/6] [oracle-jdbc] Align definitions of reflect-config with Oracle JDBC's driver metadata --- .../jdbc/oracle/deployment/OracleMetadataOverrides.java | 9 --------- 1 file changed, 9 deletions(-) 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 b6b13a7baadad..cb5c71a3bb857 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 @@ -77,15 +77,6 @@ void build(BuildProducer reflectiveClass) { .constructors().build()); reflectiveClass.produce(ReflectiveClassBuildItem.builder("oracle.sql.AnyDataFactory") .constructors().build()); - reflectiveClass - .produce(ReflectiveClassBuildItem.builder("com.sun.rowset.providers.RIOptimisticProvider") - .build()); - //This is listed in the original metadata, but it doesn't actually exist: - // reflectiveClass.produce(ReflectiveClassBuildItem.builder("oracle.jdbc.logging.annotations.Supports") - // .constructors().methods().build()); - //This is listed in the original metadata, but it doesn't actually exist: - // reflectiveClass.produce(ReflectiveClassBuildItem.builder("oracle.jdbc.logging.annotations.Feature") - // .constructors().methods().build()); } @BuildStep From 7ec1fd651578d858ee82443273abfcc793caa572 Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Thu, 18 Jul 2024 17:43:21 +0100 Subject: [PATCH 5/6] [oracle-jdbc] Complement the Oracle JDBC driver 23.4 graalvm's metadata with additional runtime-initialize definitions --- .../jdbc/oracle/deployment/OracleMetadataOverrides.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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 cb5c71a3bb857..7184b831e6173 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 @@ -123,6 +123,15 @@ void runtimeInitializeDriver(BuildProducer run runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.xa.client.OracleXAHeteroConnection")); runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.driver.T4CXAConnection")); runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.security.o5logon.O5Logon")); + + //These were missing in the original driver, and apparently in its automatic feature definitions as well; + //the need was spotted by running the native build: GraalVM will complain about these types having initialized fields + //referring to various other types which aren't allowed in a captured heap. + runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.diagnostics.Diagnostic")); + runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.replay.driver.FailoverManagerImpl")); + runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.diagnostics.CommonDiagnosable")); + runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.replay.driver.TxnFailoverManagerImpl")); + runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.diagnostics.OracleDiagnosticsMXBean")); } @BuildStep From c5c09051d902747b56123b55266261be26021d72 Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Fri, 19 Jul 2024 10:29:36 +0100 Subject: [PATCH 6/6] [oracle-jdbc] Serialization of String now needs explicit opt-in --- .../quarkus/example/jpaoracle/SerializationTestEndpoint.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/integration-tests/jpa-oracle/src/main/java/io/quarkus/example/jpaoracle/SerializationTestEndpoint.java b/integration-tests/jpa-oracle/src/main/java/io/quarkus/example/jpaoracle/SerializationTestEndpoint.java index ff7132a9c93c5..4f2198680a28b 100644 --- a/integration-tests/jpa-oracle/src/main/java/io/quarkus/example/jpaoracle/SerializationTestEndpoint.java +++ b/integration-tests/jpa-oracle/src/main/java/io/quarkus/example/jpaoracle/SerializationTestEndpoint.java @@ -11,8 +11,11 @@ import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; +import io.quarkus.runtime.annotations.RegisterForReflection; + @Path("/jpa-oracle/testserialization") @Produces(MediaType.TEXT_PLAIN) +@RegisterForReflection(targets = { String.class }, serialization = true) public class SerializationTestEndpoint { @GET