Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBM Db2 - Register resource bundle classes for reflection #36403

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I played around with this, and it seems we also need oracle.net.mesg.Message. @gsmet are you ok with me opening a PR and adding that class?

}

@BuildStep
Expand Down
Loading