如果userTransction为true,dbreport介体获取异常的原因

时间:2018-03-13 12:56:45

标签: wso2 wso2esb

当我使用dbreport mediator使用事务时,它出错了,说:

java.lang.ClassCastException: org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to javax.sql.PooledConnection

但如果我没有使用dbreport mediator的useTransaction属性为false,那么它运行正常,我不知道为什么会发生这种情况,也许是一个错误?

下面是我的配置:

<api context="/transaction" name="TransactionAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET">
    <inSequence>
        <transaction action="use-existing-or-new"/>
        <dbreport useTransaction="true">
            <connection>
                <pool>
                    <password>1</password>
                    <driver>oracle.jdbc.OracleDriver</driver>
                    <url>jdbc:oracle:thin:@10.10.90.241:1522:orcl</url>
                    <user>bap_sr</user>
                </pool>
            </connection>
            <statement>
                <sql><![CDATA[insert into action_view values('c','s','a')]]></sql>
            </statement>
        </dbreport>
        <send>
            <endpoint key="FormEp"/>
        </send>
    </inSequence>
    <outSequence>
        <transaction action="commit"/>
        <send/>
    </outSequence>
    <faultSequence/>
</resource>

1 个答案:

答案 0 :(得分:0)

这是一个错误https://github.com/wso2/product-ei/issues/1176。 您可以在master-datasource.xml中定义数据源。