From 2772bac713fd093d7acfe23140151b77ba320a90 Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Mon, 13 Jan 2025 12:30:44 +0200 Subject: [PATCH] Register Parallel Database Query related elements for reflection Although Quarkus doesn't include PDQ by default the DB2 JDBC driver still tries to access some PDQ-related elements. Relates to https://github.com/quarkusio/quarkus/issues/41995 --- .../quarkus/jdbc/db2/deployment/JDBCDB2Processor.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/extensions/jdbc/jdbc-db2/deployment/src/main/java/io/quarkus/jdbc/db2/deployment/JDBCDB2Processor.java b/extensions/jdbc/jdbc-db2/deployment/src/main/java/io/quarkus/jdbc/db2/deployment/JDBCDB2Processor.java index fd73cf836f3b1..cfd543d6d1a48 100644 --- a/extensions/jdbc/jdbc-db2/deployment/src/main/java/io/quarkus/jdbc/db2/deployment/JDBCDB2Processor.java +++ b/extensions/jdbc/jdbc-db2/deployment/src/main/java/io/quarkus/jdbc/db2/deployment/JDBCDB2Processor.java @@ -27,6 +27,7 @@ import io.quarkus.deployment.builditem.nativeimage.JPMSExportBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageAllowIncompleteClasspathBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageConfigBuildItem; +import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem; import io.quarkus.jdbc.db2.runtime.DB2AgroalConnectionConfigurer; @@ -66,7 +67,8 @@ void configureAgroalConnection(BuildProducer additional } @BuildStep - void registerForReflection(BuildProducer reflectiveClass) { + void registerForReflection(BuildProducer reflectiveClass, + BuildProducer resource) { //Not strictly necessary when using Agroal, as it also registers //any JDBC driver being configured explicitly through its configuration. //We register it for the sake of people not using Agroal, @@ -88,6 +90,12 @@ void registerForReflection(BuildProducer reflectiveCla T4Resources.class) .reason(getClass().getName() + " DB2 JDBC driver classes") .build()); + + reflectiveClass.produce(ReflectiveClassBuildItem.builder("com.ibm.pdq.cmx.client.DataSourceFactory") + .reason(getClass().getName() + " accessed reflectively by DB2 JDBC driver") + .build()); + + resource.produce(new NativeImageResourceBuildItem("pdq.properties")); } @BuildStep