This is an automated email from the ASF dual-hosted git repository.

rzo1 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomee.git


The following commit(s) were added to refs/heads/main by this push:
     new 66c0d6c3c4 Explicitly set the ctor type argument to avoid ctor name 
based resolution in xbean. Adjust name of ctor argument for xbean resolution in 
data source factory
66c0d6c3c4 is described below

commit 66c0d6c3c4edf80b6760e235c65fe58647f4a0a9
Author: Richard Zowalla <[email protected]>
AuthorDate: Sat Jan 3 19:16:51 2026 +0100

    Explicitly set the ctor type argument to avoid ctor name based resolution 
in xbean.
    Adjust name of ctor argument for xbean resolution in data source factory
---
 .../openejb/resource/jdbc/DataSourceFactory.java       | 18 +++++++++---------
 .../org/apache/openejb/util/PassthroughFactory.java    |  1 +
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/DataSourceFactory.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/DataSourceFactory.java
index 27caa2289e..fd904042a1 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/DataSourceFactory.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/DataSourceFactory.java
@@ -95,7 +95,7 @@ public class DataSourceFactory {
 
     public static CommonDataSource create(final String name,
                                           final boolean configuredManaged,
-                                          final Class impl,
+                                          final Class jdbcDriver,
                                           final String definition,
                                           final Duration maxWaitTime,
                                           final Duration 
timeBetweenEvictionRuns,
@@ -128,9 +128,9 @@ public class DataSourceFactory {
         final String jdbcUrl = properties.getProperty("JdbcUrl");
 
         final AlternativeDriver driver;
-        if (Driver.class.isAssignableFrom(impl) && jdbcUrl != null && 
useAlternativeDriver) {
+        if (Driver.class.isAssignableFrom(jdbcDriver) && jdbcUrl != null && 
useAlternativeDriver) {
             try {
-                driver = new AlternativeDriver((Driver) impl.newInstance(), 
jdbcUrl);
+                driver = new AlternativeDriver((Driver) 
jdbcDriver.newInstance(), jdbcUrl);
                 driver.register();
             } catch (final SQLException e) {
                 throw new IllegalStateException(e);
@@ -146,7 +146,7 @@ public class DataSourceFactory {
         final String resetOnError = (String) properties.remove(RESET_PROPERTY);
         final String resetMethods = (String) 
properties.remove(RESET_METHODS_PROPERTY); // before setProperties()
 
-        boolean useContainerLoader = 
"true".equalsIgnoreCase(SystemInstance.get().getProperty("openejb.resources.use-container-loader",
 "true")) && impl.getClassLoader() == DataSourceFactory.class.getClassLoader();
+        boolean useContainerLoader = 
"true".equalsIgnoreCase(SystemInstance.get().getProperty("openejb.resources.use-container-loader",
 "true")) && jdbcDriver.getClassLoader() == 
DataSourceFactory.class.getClassLoader();
         final ClassLoader oldLoader = 
Thread.currentThread().getContextClassLoader();
         if (useContainerLoader) {
             final ClassLoader containerLoader = 
DataSourceFactory.class.getClassLoader();
@@ -165,10 +165,10 @@ public class DataSourceFactory {
 
         try {
             CommonDataSource ds;
-            if (createDataSourceFromClass(impl)) { // opposed to "by driver"
+            if (createDataSourceFromClass(jdbcDriver)) { // opposed to "by 
driver"
                 trimNotSupportedDataSourceProperties(properties);
 
-                final ObjectRecipe recipe = new ObjectRecipe(impl);
+                final ObjectRecipe recipe = new ObjectRecipe(jdbcDriver);
                 recipe.allow(Option.CASE_INSENSITIVE_PROPERTIES);
                 recipe.allow(Option.IGNORE_MISSING_PROPERTIES);
                 recipe.allow(Option.NAMED_PARAMETERS);
@@ -208,12 +208,12 @@ public class DataSourceFactory {
                 if (managed) {
                     final XAResourceWrapper xaResourceWrapper = 
SystemInstance.get().getComponent(XAResourceWrapper.class);
                     if (xaResourceWrapper != null) {
-                        ds = creator.poolManagedWithRecovery(name, 
xaResourceWrapper, impl.getName(), properties);
+                        ds = creator.poolManagedWithRecovery(name, 
xaResourceWrapper, jdbcDriver.getName(), properties);
                     } else {
-                        ds = creator.poolManaged(name, impl.getName(), 
properties);
+                        ds = creator.poolManaged(name, jdbcDriver.getName(), 
properties);
                     }
                 } else {
-                    ds = creator.pool(name, impl.getName(), properties);
+                    ds = creator.pool(name, jdbcDriver.getName(), properties);
                 }
             }
 
diff --git 
a/container/openejb-core/src/main/java/org/apache/openejb/util/PassthroughFactory.java
 
b/container/openejb-core/src/main/java/org/apache/openejb/util/PassthroughFactory.java
index 0e93a32c75..1005eea869 100644
--- 
a/container/openejb-core/src/main/java/org/apache/openejb/util/PassthroughFactory.java
+++ 
b/container/openejb-core/src/main/java/org/apache/openejb/util/PassthroughFactory.java
@@ -47,6 +47,7 @@ public class PassthroughFactory {
         final String param = "instance" + recipe.hashCode();
 
         recipe.setConstructorArgNames(new String[]{param});
+        recipe.setConstructorArgTypes(new Class[]{Object.class});
         recipe.setProperty(param, instance);
 
         return recipe;

Reply via email to