Skip to content

Commit

Permalink
Register Parallel Database Query related elements for reflection
Browse files Browse the repository at this point in the history
Although Quarkus doesn't include PDQ by default the DB2 JDBC driver
still tries to access some PDQ-related elements.

Relates to quarkusio#41995
  • Loading branch information
zakkak committed Jan 13, 2025
1 parent ec6bf3c commit 2772bac
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -66,7 +67,8 @@ void configureAgroalConnection(BuildProducer<AdditionalBeanBuildItem> additional
}

@BuildStep
void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
BuildProducer<NativeImageResourceBuildItem> 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,
Expand All @@ -88,6 +90,12 @@ void registerForReflection(BuildProducer<ReflectiveClassBuildItem> 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
Expand Down

0 comments on commit 2772bac

Please sign in to comment.