Skip to content

Commit

Permalink
IBM Db2 - Register resource bundle classes for reflection
Browse files Browse the repository at this point in the history
As usual with Db2, we are shooting in the dark a bit but it seems to
solve the OP's issue.

Fixes #36399
  • Loading branch information
gsmet committed Oct 11, 2023
1 parent 049f6f0 commit 78d5bc3
Showing 1 changed file with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
package io.quarkus.jdbc.db2.deployment;

import com.ibm.db2.jcc.resources.ResourceKeys;
import com.ibm.db2.jcc.resources.Resources;
import com.ibm.db2.jcc.resources.SqljResources;
import com.ibm.db2.jcc.resources.T2uResourceKeys;
import com.ibm.db2.jcc.resources.T2uResources;
import com.ibm.db2.jcc.resources.T2zResourceKeys;
import com.ibm.db2.jcc.resources.T2zResources;
import com.ibm.db2.jcc.resources.T4ResourceKeys;
import com.ibm.db2.jcc.resources.T4Resources;

import io.quarkus.agroal.spi.JdbcDriverBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.processor.BuiltinScope;
Expand Down Expand Up @@ -55,12 +65,23 @@ void configureAgroalConnection(BuildProducer<AdditionalBeanBuildItem> additional
}

@BuildStep
void registerDriverForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
//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,
//for example when the driver is used with OpenTelemetry JDBC instrumentation.
reflectiveClass.produce(ReflectiveClassBuildItem.builder(DB2_DRIVER_CLASS).build());

// register resource bundles for reflection (they are apparently classes...)
reflectiveClass.produce(ReflectiveClassBuildItem.builder(Resources.class).build());
reflectiveClass.produce(ReflectiveClassBuildItem.builder(ResourceKeys.class).build());
reflectiveClass.produce(ReflectiveClassBuildItem.builder(SqljResources.class).build());
reflectiveClass.produce(ReflectiveClassBuildItem.builder(T2uResourceKeys.class).build());
reflectiveClass.produce(ReflectiveClassBuildItem.builder(T2uResources.class).build());
reflectiveClass.produce(ReflectiveClassBuildItem.builder(T2zResourceKeys.class).build());
reflectiveClass.produce(ReflectiveClassBuildItem.builder(T2zResources.class).build());
reflectiveClass.produce(ReflectiveClassBuildItem.builder(T4ResourceKeys.class).build());
reflectiveClass.produce(ReflectiveClassBuildItem.builder(T4Resources.class).build());
}

@BuildStep
Expand Down

0 comments on commit 78d5bc3

Please sign in to comment.