0

在 JBoss eap 7.0 上运行应用程序。我有一个 MDB,它还引用 XA 数据源(oracle)来持久化数据。在长时间没有使用(几个小时)之后,下一次写入 DB 的 onMessage 调用出现以下错误

    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

我应该设置 validate-on-match = true,还是有更好的方法来确保池连接有效且处于活动状态?

更新:将配置更改为:

                <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>  

仍然出现错误。

4

1 回答 1

1

是的,所有数据源都必须设置连接池验证:

<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"‌​&gt;</exception-sorter> 

</validation> 

还要验证is-same-rm-override 和 no-tx-separate-pools元素在每个 Oracle 特定涉及的每个 xa-datasource 中明确声明(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>
于 2017-10-09T10:29:11.403 回答