![JBoss EAP XA 数据源与 MDB 发生故障](https://linux22.com/image/711351/JBoss%20EAP%20XA%20%E6%95%B0%E6%8D%AE%E6%BA%90%E4%B8%8E%20MDB%20%E5%8F%91%E7%94%9F%E6%95%85%E9%9A%9C.png)
我有一个正在运行的 MDB,正在将数据发布到 Oracle 数据库。XA 数据源配置如下:
<xa-datasource jndi-name="java:/jdbc/HIF-BannerPU" pool-name="HIF-BannerPU" enabled="true" spy="true" use-ccm="true" statistics-enabled="false">
<xa-datasource-property name="URL">
${hif-db-url}
</xa-datasource-property>
<driver>OracleJDBCDriver</driver>
<security>
<user-name>uifsmgr</user-name>
<password>u_pick_it</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<use-fast-fail>false</use-fast-fail>
</validation>
<timeout>
<set-tx-query-timeout>false</set-tx-query-timeout>
<blocking-timeout-millis>0</blocking-timeout-millis>
<idle-timeout-minutes>0</idle-timeout-minutes>
<query-timeout>0</query-timeout>
<use-try-lock>0</use-try-lock>
<allocation-retry>0</allocation-retry>
<allocation-retry-wait-millis>0</allocation-retry-wait-millis>
</timeout>
<statement>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</xa-datasource>
空闲运行一段时间后(不确定具体的时间跨度,可能是几个小时),下一个 MDB onMessage 抛出此异常:
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
我假设这与连接池验证有关。不确定解决方案是否只是设置为 true,或者是否还有其他配置需要完成。
答案1
尝试使用明确的 Oracle 池标志:
<xa-pool>
<is-same-rm-override>false</is-same-rm-override>
<no-tx-separate-pools />
...other settings
</xa-pool>
有Oracle XA 问题配置过去,不确定现在是否一切都已解决。