[mule-user] Re: XA Transactions

7 views
Skip to first unread message

Marie Claire Rizzo

unread,
Aug 6, 2007, 8:10:33 AM8/6/07
to us...@mule.codehaus.org
Hi,

I'm trying to build a simple example using Mule XA Transactions. I'm
trying to use JMS (activeMQ) with a configured XA resource. The
descriptor looks like the following:

<mule-descriptor name="JmsTransUMO" implementation="org.foo.MyComponent">
<inbound-router>
<endpoint address="jms://my.queue"
connector="jmsXAConnector">
<transaction action="ALWAYS_BEGIN"
factory="org.mule.transaction.XaTransactionFactory"/>
</endpoint>
</inbound-router>
<mule-descriptor>

The JmsTransUMO manages to receive components when I send a jms message
on the jms://my.queue using a standard non-XA JMS connector; the
transaction begin on the receiver.... However, when I try to send or
dispatch on jms://my.queue from the MuleClient using the jmsXAConnector,
Mule blows up with the following error. Does anyone know what I'm doing
wrong???

org.mule.umo.provider.DispatchException: Failed to route event via
endpoint: MuleEndpoint{endpointUri=jms://my.queue,
connector=ActiveMqJmsConnector{this=3a5794, started=true,
initialised=true, name='jmsXAConnector', disposed=false,
numberOfConcurrentTransactedReceivers=4,
createMultipleTransactedReceivers=true, connected=true,
supportedProtocols=[jms], serviceOverrides=null},
transformer=ObjectToJMSMessage{this=33b121, name='ObjectToJMSMessage',
ignoreBadInput=false, returnClass=null, sourceTypes=[]},
name='testEndpoint', type='senderAndReceiver', properties={},
transactionConfig=Transaction{factory=null, action=NONE, timeout=30000},
filter=null, deleteUnacceptedMessages=false, initialised=true,
securityFilter=null, synchronous=true, initialState=started,
createConnector=0, remoteSync=true, remoteSyncTimeout=null,
endpointEncoding=null}. Message payload is of type: String
at
org.mule.providers.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:252)
at
org.mule.providers.AbstractConnector.send(AbstractConnector.java:1605)
at
org.mule.impl.ImmutableMuleEndpoint.send(ImmutableMuleEndpoint.java:961)
at org.mule.impl.MuleSession.sendEvent(MuleSession.java:327)
at org.mule.extras.client.MuleClient.sendNoReceive(MuleClient.java:937)
at
org.foo.XATransactionsWithSpringDAO.testXATransactionUsingSpringDaoNoRollback(XATransactionsWithSpringDAO.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at
org.mule.tck.AbstractMuleTestCase.runBare(AbstractMuleTestCase.java:179)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at org.mule.tck.AbstractMuleTestCase.run(AbstractMuleTestCase.java:149)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.reflect.UndeclaredThrowableException
at $Proxy3.send(Unknown Source)
at org.mule.providers.jms.Jms11Support.send(Jms11Support.java:228)
at
org.mule.providers.jms.JmsMessageDispatcher.dispatchMessage(JmsMessageDispatcher.java:273)
at
org.mule.providers.jms.JmsMessageDispatcher.doSend(JmsMessageDispatcher.java:330)
at
org.mule.providers.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java:224)
... 25 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.mule.providers.jms.xa.ConnectionFactoryWrapper$ConnectionInvocationHandler$SessionInvocationHandler$ConsumerProducerInvocationHandler.invoke(ConnectionFactoryWrapper.java:372)
... 30 more
Caused by: javax.jms.JMSException: Session's XAResource has not been
enlisted in a distributed transaction.
at
org.apache.activemq.ActiveMQXASession.doStartTransaction(ActiveMQXASession.java:110)
at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1502)
at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:465)
at
org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:384)
... 35 more

The configuration of the jmsXAConnector is the following:

<connector name="jmsXAConnector"
className="org.mule.providers.jms.activemq.ActiveMqJmsConnector">
<properties>
<container-property name="connectionFactory"
reference="jmsConnectionFactory"/>
<property name="specification" value="1.1"/>
</properties>
</connector>

The jmsConnectionFactory to which the connector refers is the following:

<bean id="jmsConnectionFactory"
class="org.mule.providers.jms.xa.ConnectionFactoryWrapper">
<constructor-arg index="0">
<ref bean="jmsConnectionFactoryXa"/>
</constructor-arg>
<constructor-arg index="1" ref="jotm"/>
</bean>

<!-- ActiveMQ -->
<bean id="jmsConnectionFactoryXa"
class="org.apache.activemq.ActiveMQXAConnectionFactory">
<!--<property
name="brokerURL"><value>tcp://localhost:61616</value></property>-->
<property
name="brokerURL"><value>vm://localhost?broker.persistent=false&amp;broker.useJmx=false</value></property>
</bean>


---------------------------------------------------------------------
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Marie Claire Rizzo

unread,
Aug 6, 2007, 1:07:54 PM8/6/07
to us...@mule.codehaus.org
Never mind. My bad.

Andrew Perepelytsya

unread,
Aug 6, 2007, 1:32:12 PM8/6/07
to us...@mule.codehaus.org
Marie,

Want to share the solution for a record? I don't think you need to explicitly declare the connection factory wrapper, that is Mule's task.

>    at org.mule.impl.MuleSession.sendEvent (MuleSession.java:327)

>    at
> org.mule.extras.client.MuleClient.sendNoReceive(MuleClient.java:937)
>    at
> org.foo.XATransactionsWithSpringDAO.testXATransactionUsingSpringDaoNoRollback(XATransactionsWithSpringDAO.java :80)
>
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>    at sun.reflect.DelegatingMethodAccessorImpl.invoke (Unknown Source)

>    at java.lang.reflect.Method.invoke(Unknown Source)
>    at junit.framework.TestCase.runTest(TestCase.java:164)
>    at junit.framework.TestCase.runBare(TestCase.java:130)
>    at
> org.mule.tck.AbstractMuleTestCase.runBare(AbstractMuleTestCase.java:179)
>    at junit.framework.TestResult$1.protect(TestResult.java:106)
>    at junit.framework.TestResult.runProtected(TestResult.java :124)
>    at junit.framework.TestResult.run(TestResult.java:109)
>    at junit.framework.TestCase.run(TestCase.java:120)
>    at
> org.mule.tck.AbstractMuleTestCase.run(AbstractMuleTestCase.java:149)
>    at junit.framework.TestSuite.runTest(TestSuite.java:230)
>    at junit.framework.TestSuite.run(TestSuite.java:225)
>    at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run (JUnit3TestReference.java:128)
>
>    at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>
>    at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (RemoteTestRunner.java:460)
>
>    at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
>
>    at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (RemoteTestRunner.java:386)

>
>    at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
>
> Caused by: java.lang.reflect.UndeclaredThrowableException
>    at $Proxy3.send(Unknown Source)
>    at org.mule.providers.jms.Jms11Support.send(Jms11Support.java:228)
>    at
> org.mule.providers.jms.JmsMessageDispatcher.dispatchMessage(JmsMessageDispatcher.java :273)
>
>    at
> org.mule.providers.jms.JmsMessageDispatcher.doSend(JmsMessageDispatcher.java:330)
>
>    at
> org.mule.providers.AbstractMessageDispatcher.send(AbstractMessageDispatcher.java :224)
>
>    ... 25 more
> Caused by: java.lang.reflect.InvocationTargetException
>    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>    at sun.reflect.NativeMethodAccessorImpl.invoke (Unknown Source)

>    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>    at java.lang.reflect.Method.invoke(Unknown Source)
>    at
> org.mule.providers.jms.xa.ConnectionFactoryWrapper$ConnectionInvocationHandler$SessionInvocationHandler$ConsumerProducerInvocationHandler.invoke (ConnectionFactoryWrapper.java:372)

>
>    ... 30 more
> Caused by: javax.jms.JMSException: Session's XAResource has not been
> enlisted in a distributed transaction.
>    at
> org.apache.activemq.ActiveMQXASession.doStartTransaction (ActiveMQXASession.java:110)

Marie Claire Rizzo

unread,
Aug 7, 2007, 2:47:14 AM8/7/07
to us...@mule.codehaus.org
Hi,

Infact that was my problem... with my explicitly declared factory
wrapper things were falling apart. When I left this in the hands on
Mule, things started to work ;)

Andrew Perepelytsya wrote:
> Marie,
>
> Want to share the solution for a record? I don't think you need to
> explicitly declare the connection factory wrapper, that is Mule's task.
>

> On 8/6/07, * Marie Claire Rizzo* <marie...@ricston.com

Reply all
Reply to author
Forward
0 new messages