jdbcxajboss-eap-7jboss-mdb

MDB onMessage fails with closed JDBC connection


Running an app on JBoss eap 7.0. I have an MDB that also references a XA data source (oracle) to persist data. After a long time span of no use (several hours), next onMessage invocation that does to write to DB, gets error below

    org.hibernate.exception.GenericJDBCException: Unable to acquire JDBC Connection


    Caused by: java.sql.SQLException: javax.resource.ResourceException: 
IJ000457: Unchecked throwable in managedConnectionReconnected() 
cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@178ff38
2[state=DESTROYED managed 
connection=org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@70289860 connection handles=0 lastReturned=1506796773697 lastValidated=1506796773525 lastCheckedOut=1506947349429 trackByTx=false 
pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@5968abc8 
mcp=SemaphoreConcurrentLinkedQueueManagedConnectionPool@83405c5[pool=HIF-
BannerPU] 
xaResource=XAResourceWrapperImpl@2168086b[xaResource=org.jboss.jca.adapters.j
dbc.xa.XAManagedConnection@70289860 pad=false overrideRmValue=null 
productName=Oracle productVersion=Oracle Database 12c Enterprise Edition 
Release 12.2.0.1.0 - 64bit Production jndiName=java:/jdbc/HIF-BannerPU] 
txSync=null

Should I be setting validate-on-match = true, or is there a better approach to ensure pooled connection is valid and active?

UPDATE: changed config to:

                <validation>
                    <validate-on-match>true</validate-on-match> 
                    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.Or‌​acleValidConnectionC‌​hecker"/>
                    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.Or‌​acleExceptionSorter" />
                </validation> 
                <xa-pool>
                    <is-same-rm-override>false</is-same-rm-override>
                    <no-tx-separate-pools />
                </xa-pool>  

Still getting error.


Solution

  • Yes connection pool validation settings is mandatory for all the data sources:

    <validation> 
    
    <validate-on-match>true</validate-on-match> <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.Or‌​acleValidConnectionC‌​hecker"></valid-conn‌​ection-checker> 
    
    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.Or‌​acleExceptionSorter"‌​></exception-sorter> 
    
    </validation> 
    

    Also verify the is-same-rm-override and no-tx-separate-pools elements are explicitly declared in each xa-datasource involved per Oracle specific (https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html-single/configuration_guide/#example_oracle_xa_datasource)

    <xa-pool> ... 
    <is-same-rm-override>false</is-same-rm-override> 
    <no-tx-separate-pools /> 
    </xa-pool>