在JBoss EAP 7 standalone.xml中配置jt400 xa-datasource

时间:2017-07-13 13:50:16

标签: jboss db2 datasource xa jt400

我在c:\ jboss-EAP7 \ modules \ com \ ibm \ main \中有as400驱动文件(jt400.jar)和相应的module.xml

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.ibm">
    <resources>
        <resource-root path="jt400.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
        <module name="javax.servlet.api" optional="true"/>
    </dependencies>
</module>

以下是我的standalone.xml中的数据源配置:

<subsystem xmlns="urn:jboss:domain:datasources:4.0">
            <datasources>
                <xa-datasource jndi-name="java:/ds/DB2DataSource" pool-name="ds/DB2DataSource" enabled="true" use-java-context="true" use-ccm="true"> 
                    <xa-datasource-property name="ServerName">
                        xxx.xx.xxx.x
                    </xa-datasource-property>
                    <driver>as400</driver>
                    <xa-pool>
                        <is-same-rm-override>false</is-same-rm-override>
                        <no-tx-separate-pools>true</no-tx-separate-pools>
                        <interleaving>false</interleaving>
                        <pad-xid>false</pad-xid>
                        <wrap-xa-resource>false</wrap-xa-resource>
                    </xa-pool>                       
                    <security>
                        <user-name>user</user-name>
                        <password>pass</password>
                    </security>
                    <validation>
                        <validate-on-match>false</validate-on-match>
                        <background-validation>false</background-validation>
                    </validation>
                    <statement>
                        <share-prepared-statements>false</share-prepared-statements>
                    </statement>
                </xa-datasource>
                <drivers>
                   <driver name="as400" module="com.ibm">
                        <xa-datasource-class>com.ibm.as400.access.AS400JDBCXADataSource</xa-datasource-class>
                    </driver>
                </drivers>
            </datasources>
        </subsystem>

我在数据源绑定中遇到以下问题:

15:44:00,482 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("xa-data-source" => "ds/DB2DataSource")
]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => [
    "jboss.driver-demander.java:/ds/DB2DataSource is missing [jboss.jdbc-driver.as400]",
    "org.wildfly.data-source.ds/DB2DataSource is missing [jboss.jdbc-driver.as400]"
]}
15:44:00,485 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("xa-data-source" => "ds/DB2DataSource")
]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => [
    "jboss.driver-demander.java:/ds/DB2DataSource is missing [jboss.jdbc-driver.as400]",
    "org.wildfly.data-source.ds/DB2DataSource is missing [jboss.jdbc-driver.as400]",
    "org.wildfly.data-source.ds/DB2DataSource is missing [jboss.jdbc-driver.as400]"
]}

我做错了什么? 请注意,使用SQLClient(例如DBeaver)时,使用相同参数连接成功。

由于

2 个答案:

答案 0 :(得分:0)

您需要从module.xml文件中删除 XML声明

我复制了您的配置,发现删除module.xml文件的第一行后,错误不再出现。

答案 1 :(得分:0)

在 module.xml 上试试这个

<module xmlns="urn:jboss:module:1.5" name="com.ibm.as400">

<resources>
    <resource-root path="jt400-10.2.jar"/>
    <!-- Insert resources here -->
</resources>
<dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
    <module name="javax.servlet.api" optional="true"/>
</dependencies>

这在standalone.xml

<drivers>
    <driver name="jt400" module="com.ibm.as400">
            <driver-class>com.ibm.as400.access.AS400JDBCDriver</driver-class>
            <xa-datasource-class>com.ibm.as400.access.AS400JDBCXADataSource</xa-datasource-class>
   </driver>
</drivers>