Issue Details (XML | Word | Printable)

Key: MULE-3483
Type: Bug Bug
Status: Pending 3rd-Party Pending 3rd-Party
Priority: To be reviewed To be reviewed
Assignee: Unassigned
Reporter: Nicol McKenna
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Mule

Exception Using XA Transactions With JDBC Connector (Mule transaction is null, but enlist method is called)

Created: 25/Jun/08 10:07 AM   Updated: 26/Jun/08 04:10 AM
Component/s: Modules: Transactions (JBoss/Arjuna/JOTM), Transport: JDBC
Affects Version/s: 1.4.4
Fix Version/s: None

Time Tracking:
Not Specified

Environment:
OS: Windows XP Pro
DB: Oracle 10g
JDBC Jar: ojdbc14-10.2.0.jar
JDK 1.6

Labels:
User impact: Medium
Configuration:
<!-- XA Datasource Configuration -->

<beans>
<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean"/>
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="userTransaction" ref="jotm"/>
<property name="transactionManager" ref="jotm"/>
</bean>

<bean id="MAFXADataSource" class="org.mule.providers.jdbc.xa.DataSourceWrapper">
<constructor-arg ref="xaDataSource"/>
<constructor-arg ref="jotm"/>
</bean>

<bean id="xaDataSource" class="oracle.jdbc.xa.client.OracleXADataSource" destroy-method="shutdown">
<property name="URL" value="jdbc:oracle:thin:@localhost:1521:Xe" />
<property name="user" value="USERNAME"/>
<property name="password" value="PASSWORD"/>
</bean>
</beans>

<!-- Connector Configuration -->

<!-- Configure the JDBC connector -->
<connector name="jdbcConnector" className="org.mule.providers.jdbc.JdbcConnector">
<properties>
<container-property name="dataSource" reference="MAFXADataSource"/>
<property name="pollingFrequency" value="10000"/>
<map name="queries">
<property name="getConsumerDemoRecs" value="SELECT CURRENCY FROM consumerdemo where MSGID='1'"/>
</map>
</properties>
</connector>

<!-- Endpoint Configuration -->

<endpoint name="JDBC_GetConsumerDemoRecs" address="jdbc://getConsumerDemoRecs" transformers="MessageWrapper">
<transaction action="ALWAYS_BEGIN" factory="org.mule.transaction.XaTransactionFactory"/>
</endpoint>

<!-- Transaction Manager Configuration -->
<transaction-manager factory="org.mule.extras.jotm.JotmTransactionManagerFactory"/>

<!-- Mule model Configuration -->

<model name="Mule-app">

<mule-descriptor name="XADB_Test_Component" implementation="xaDBTest">
<inbound-router>
<global-endpoint name="JDBC_GetConsumerDemoRecs"/>
</inbound-router>
</mule-descriptor>
</model>

Log Output:
2008-06-25 11:09:09,232 (MuleManager.java:900) INFO org.mule.MuleManager -
**********************************************************************
* Mule ESB and Integration Platform *
* Version: 1.4.4 Build: 11748 *
* MuleSource, Inc. *
* For more information go to http://mule.mulesource.org *
* *
* Server started: 25/06/08 11:09 *
* Server ID: MAF-config *
* JDK: 1.6.0_04 (mixed mode, sharing) *
* OS: Windows XP - Service Pack 2 (5.1, x86) *
* Host: LGLAIB8HBBJ2J (169.24.29.131) *
* *
* Agents Running: *
* JMX Agent *
* Wrapper Manager: Mule PID #3920, Wrapper PID #3940 *
**********************************************************************
2008-06-25 11:09:09,232 (MuleServer.java:300) INFO org.mule.MuleServer - Mule Server initialized.
2008-06-25 11:09:10,420 (AbstractExceptionListener.java:310) ERROR org.mule.impl.DefaultExceptionStrategy -
********************************************************************************
Message : Mule transaction is null, but enlist method is called
Type : org.mule.transaction.IllegalTransactionStateException
Code : MULE_ERROR-91530
JavaDoc : http://mule.mulesource.org/docs/apidocs/org/mule/transaction/IllegalTransactionStateException.html
********************************************************************************
Exception stack is:
1. Mule transaction is null, but enlist method is called (org.mule.transaction.IllegalTransactionStateException)
  org.mule.providers.jdbc.xa.ConnectionWrapper:463 (http://mule.mulesource.org/docs/apidocs/org/mule/transaction/IllegalTransactionStateException.html)
********************************************************************************
Root Exception stack trace:
org.mule.transaction.IllegalTransactionStateException: Mule transaction is null, but enlist method is called
        at org.mule.providers.jdbc.xa.ConnectionWrapper.enlist(ConnectionWrapper.java:463)
        at org.mule.providers.jdbc.xa.StatementInvocationHandler.invoke(StatementInvocationHandler.java:40)
        at $Proxy0.executeQuery(Unknown Source)
        at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:236)
        at org.mule.providers.jdbc.JdbcMessageReceiver.getMessages(JdbcMessageReceiver.java:154)
        at org.mule.providers.TransactedPollingMessageReceiver.poll(TransactedPollingMessageReceiver.java:136)
        at org.mule.providers.PollingReceiverWorker.run(PollingReceiverWorker.java:47)
        at org.mule.impl.work.WorkerContext.run(WorkerContext.java:310)
        at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
        at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
        at java.lang.Thread.run(Thread.java:619)

********************************************************************************


 Description  « Hide
As part of my application (running on Mule 1.4.4) I am trying to use the JDBC connector to read some information from the database and then continue to process that information all inside of an XA Transaction. Any time I try to use the JDBC Connector under an XA Transaction I get the "Mule transaction is null, but enlist method is called" error.

I created the example configuration above to try and isolate the error. The example configuration works on Mule 1.4.3 but fails with the "Mule transaction is null, but enlist method is called" error on 1.4.4.

Also, when I run the above on Mule 1.4.4 without transactions it works successfully.



 All   Comments   Work Log   Change History   Transitions   FishEye      Sort Order: Ascending order - Click to sort in descending order
Andrew Perepelytsya added a comment - 25/Jun/08 12:25 PM
This is typically a misconfiguration. 1.4.4 is more strict with this case, as it's really an error, and proceeding would cause unexpected results. I don't see why you'd use the DataSourceWrapper. What happened when you used OracleDataSource?

Nicol McKenna added a comment - 26/Jun/08 04:10 AM
Hi Andrew,

I was using the DataSourceWrapper based on an example I'd found online around Mule and XA transactions with JDBC.

If I strip out the DataSourceWrapper and use the oracle.jdbc.xa.client.OracleXADataSource directly then I get the same error. If, as you suggested I use the oracle.jdbc.pool.OracleDataSource then the problem goes away and the app seems to work.

I have a question about this though - is using the OracleDataSource enough to take part in the XA transaction in Mule ? Or would you not have to use the OracleXADataSource to take part in XA Transactions?

Thanks.