Details
-
Bug
-
Resolution: Done
-
Major
-
jboss-fuse-6.2.1
-
None
-
Sprint 5 - towards ER2
Description
An application defines an XA-aware connection pool as follows:
<bean id="ariesTransactionManager" class="org.apache.aries.transaction.internal.AriesTransactionManagerImpl"> ... </bean> <bean id="internalXaDataSource" class="org.h2.jdbcx.JdbcDataSource"> <property name="URL" value="..."/> <property name="description" value="..."/> </bean> <bean id="dataSource" class="org.apache.aries.transaction.jdbc.RecoverableDataSource" init-method="start"> <property name="transactionManager" ref="ariesTransactionManager"/> <property name="dataSource" ref="internalXaDataSource"/> <property name="backgroundValidation" value="true"/> <property name="transaction" value="xa"/> ... </bean>
So long as backgroundValidation==true, the application fails at runtime with the following exception:
Caused by: java.lang.RuntimeException: java.lang.NoSuchFieldException: pool at org.apache.aries.transaction.jdbc.internal.Reflections.get(Reflections.java:56) at org.apache.aries.transaction.jdbc.internal.ValidatingGenericConnectionManager.<init>(ValidatingGenericConnectionManager.java:89) at org.apache.aries.transaction.jdbc.internal.ConnectionManagerFactory.init(ConnectionManagerFactory.java:152) at org.apache.aries.transaction.jdbc.RecoverableDataSource.start(RecoverableDataSource.java:235) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497)
This seems to be a defect in org.apache.aries.transaction.jdbc.internal.ValidatingGenericConnectionManager:
if (current instanceof AbstractSinglePoolConnectionInterceptor) { foundPool = Reflections.get(stack, "pool"); //----- PROBLEM! } else if (current instanceof MultiPoolConnectionInterceptor) { log.warn("validation on stack {} not supported", stack); }
Intuitively we thing that Reflections.get() should be called on "current" not on "stack"; current is an instance of AbstractSinglePoolConnectionInterceptor, and thus has a "pool" property; "stack" is an instance of ConnectionInterceptor, that does not.