From 81bc60764f097972efd8a897d3c9ded18ee9b66a 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, 10 insertions(+) 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 fd73cf836f3b1a..3d0fd31c128040 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; @@ -88,6 +89,10 @@ 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()); } @BuildStep @@ -133,4 +138,9 @@ void addExportsToNativeImage(BuildProducer jpmsExports) { // --add-exports=java.base/sun.security.action=ALL-UNNAMED jpmsExports.produce(new JPMSExportBuildItem("java.base", "sun.security.action")); } + + @BuildStep + NativeImageResourceBuildItem registerResources() { + return new NativeImageResourceBuildItem("pdq.properties"); + } }