You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Yuen Chi Lian <yu...@gmail.com> on 2007/10/10 14:36:54 UTC

Quick question on ActiveMQConnectionFactory and ActiveMQXAConnectionFactory

Hi guys,

I have looked into the API documentation at:
http://activemq.apache.org/maven/activemq-core/apidocs/org/apache/activemq/ActiveMQXAConnectionFactory.html

However, I couldn't find any information or confirmation regarding when and
how should the ActiveMQXAConnectionFactory should be used. What I mean is,
if I am not doing a XA transaction (but just a single resource transaction),
is it wrong to use the ActiveMQXAConnectionFactory? Or it's actually my
configuration mistake to cause this:

javax.jms.JMSException: Session's XAResource has not been enlisted in a
distributed transaction.
    at org.apache.activemq.ActiveMQXASession.doStartTransaction(
ActiveMQXASession.java:109)
    at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1587)
    at org.apache.activemq.ActiveMQMessageProducer.send(
ActiveMQMessageProducer.java:226)
    at org.apache.activemq.ActiveMQMessageProducerSupport.send(
ActiveMQMessageProducerSupport.java:240)
    at foo.main.tx.TestSpringTx.testProducingToQueue(TestSpringTx.java:147)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    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:118)
    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)

Here's my configuration:


    <bean id="innerConnectionFactory" class="
org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="tcp://localhost:61616" />
    </bean>

    <bean id="pooledConnectionFactory" class="
org.apache.activemq.pool.PooledConnectionFactory">
        <property name="connectionFactory" ref="innerConnectionFactory"/>
    </bean>

    <bean id="connectionFactory" class="
org.springframework.jms.connection.TransactionAwareConnectionFactoryProxy">
        <property name="targetConnectionFactory"
ref="pooledConnectionFactory"></property>
    </bean>

I have tried grabbing each single bean above and the results are the same.

-- 
Cheers,
Yuen-Chi Lian

"I do not seek; I find." - Pablo Picasso