This is an automated email from the ASF dual-hosted git repository. rzo1 pushed a commit to branch xbean-4.30-SNAPSHOT in repository https://gitbox.apache.org/repos/asf/tomee.git
commit 551ac6e38aa1dbd790baca4b919eb0340a98e2ac Author: Richard Zowalla <[email protected]> AuthorDate: Sun Jan 4 20:24:24 2026 +0100 Implement constructor-types matching for geronimo transaction manager case --- .../openejb/config/ConfigurationFactory.java | 24 +++++++++++++++++++++- .../apache/openejb/config/sys/ServiceProvider.java | 1 + .../META-INF/org.apache.openejb/service-jar.xml | 15 +++++++------- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java b/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java index 5428f049b8..4f92eb779d 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/config/ConfigurationFactory.java @@ -107,6 +107,7 @@ import jakarta.ejb.embeddable.EJBContainer; import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.lang.reflect.Array; import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; @@ -1612,7 +1613,7 @@ public class ConfigurationFactory implements OpenEjbConfigurationFactory { return parseList(service.getConstructorTypes()).stream() .map(it -> { try { - return Class.forName(it); + return getClassForType(it); } catch (final ClassNotFoundException e) { throw new OpenEJBRuntimeException(e); } @@ -1620,6 +1621,27 @@ public class ConfigurationFactory implements OpenEjbConfigurationFactory { .collect(Collectors.toUnmodifiableList()); } + private Class<?> getClassForType(String typeName) throws ClassNotFoundException { + if (typeName.endsWith("[]")) { + final String elementType = typeName.substring(0, typeName.length() - 2); + final Class<?> elementClass = getClassForType(elementType); // recursion + return Array.newInstance(elementClass, 0).getClass(); + } + + return switch (typeName) { + case "boolean" -> boolean.class; + case "byte" -> byte.class; + case "char" -> char.class; + case "short" -> short.class; + case "int" -> int.class; + case "long" -> long.class; + case "float" -> float.class; + case "double" -> double.class; + case "void" -> void.class; + default -> Class.forName(typeName); // regular case + }; + } + protected List<String> getResourceIds() { return getResourceIds(null); } diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/sys/ServiceProvider.java b/container/openejb-core/src/main/java/org/apache/openejb/config/sys/ServiceProvider.java index cfcf8a6c71..1b2c042298 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/config/sys/ServiceProvider.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/config/sys/ServiceProvider.java @@ -46,6 +46,7 @@ import java.util.Properties; * <attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * <attribute name="provider-type" use="required" type="{http://www.openejb.org/Service/Configuration}ProviderTypes" /> * <attribute name="constructor" type="{http://www.w3.org/2001/XMLSchema}string" /> + * <attribute name="constructor-types" type="{http://www.w3.org/2001/XMLSchema}string" /> * <attribute name="factory-name" type="{http://www.w3.org/2001/XMLSchema}string" /> * </extension> * </simpleContent> diff --git a/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml b/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml index 50ef7c58eb..5a16c882b6 100644 --- a/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml +++ b/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/service-jar.xml @@ -125,7 +125,7 @@ # side of the pool reaches its `MaxAge`, it is also immediately # replaced. Replacement is done in a background queue using the # number of threads specified by `CallbackThreads`. - + MinSize = 0 # StrictPooling tells the container what to do when the pool @@ -362,7 +362,7 @@ # annotation is used. AccessTimeout = 30 seconds - + </ServiceProvider> @@ -428,10 +428,10 @@ # override this setting for the bean where the annotation is used. TimeOut 20 - - # Specifies the frequency (in seconds) at which the bean cache is checked for + + # Specifies the frequency (in seconds) at which the bean cache is checked for # idle beans. - + Frequency 60 # Specifies the size of the bean pools for this @@ -510,8 +510,8 @@ service="SecurityService" types="SecurityService" class-name="org.apache.openejb.core.security.SecurityServiceImpl"> - - DefaultUser guest + + DefaultUser guest </ServiceProvider> <ServiceProvider @@ -531,6 +531,7 @@ types="TransactionManager" factory-name="create" constructor="defaultTransactionTimeoutSeconds, defaultTransactionTimeout, TxRecovery, tmId, bufferClassName, bufferSizeKb, checksumEnabled, adler32Checksum, flushSleepTimeMilliseconds, flushSleepTime, logFileDir, logFileExt, logFileName, maxBlocksPerFile, maxBuffers, maxLogFiles, minBuffers, threadsWaitingForceThreshold" + constructor-types="java.lang.Integer, org.apache.openejb.util.Duration, boolean, byte[], java.lang.String, int, boolean, boolean, java.lang.Integer, org.apache.openejb.util.Duration, java.lang.String, java.lang.String, java.lang.String, int, int, int, int, int" class-name="org.apache.openejb.resource.GeronimoTransactionManagerFactory"> defaultTransactionTimeout 10 minutes
