使用 jBoss + Oracle 使用 oracle-xa-ds.xml 進行分散式交易處理
我們會進行 配置 2到多個資料庫 在啟動jBoss時會報:
org.jboss.deployment.DeploymentException: Trying to install an already registered mbean: jboss.jca:service=OracleXAExceptionFormatter
jBoss內容:
--- Incompletely deployed packages ---
org.jboss.deployment.DeploymentInfo@9dc2668e { url=file:/G:/jboss-4.2.3.GA/server/CE/deploy/Objst1DSXA-ds.xml }
deployer: org.jboss.deployment.XSLSubDeployer@3b100c
status: Deployment FAILED reason: Trying to install an already registered mbean: jboss.jca:service=OracleXAExceptionFormatter
state: FAILED
watch: file:/G:/jboss-4.2.3.GA/server/CE/deploy/Objst1DSXA-ds.xml
altDD: null
lastDeployed: 1259016129625
lastModified: 1259016129609
mbeans:
原因:
When creating datasources using the P8 Configuration Manager and executing the 'Configure JDBC Data Sources' task, two data source files (one XA and one non-XA) are placed into the deployed JBoss server. The XA data source files will contain the following lines:
<mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"
name="jboss.jca:service=OracleXAExceptionFormatter">
<depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
</mbean>
Only one XA data source file can contain the above entry. The problem occurs when more than one XA data source file contains this entry.
All XA datasource files created by the P8 Configuration Manager utility will have the "mbean code" entry in the file. This entry will need to be removed from all XA datasource files
that were created by the P8 Configuration Manager utility after the GCD XA datasource file was created. It should remain in the GCD XA data source file because that is the first XA datasource file to be created and it should be in one of the files.
!!!!!!!!!!!!!!!!!!!
解決方案:
將你所配置的資料庫檔案 如:oracle1-xa-ds.xml、oracle2-xa-ds.xml、oracle3-xa-ds.xml .......
jBoss只能正常載入一個 所以之後的 *.xml都會報以上錯誤
我們只要將 第2-n個*.xml 的內容刪除:
<mbean code="org.jboss.resource.adapter.jdbc.vendor.OracleXAExceptionFormatter"
name="jboss.jca:service=OracleXAExceptionFormatter">
<depends optional-attribute-name="TransactionManagerService">jboss:service=TransactionManager</depends>
</mbean>
再重啟jBoss