Atomikos Forum

com.atomikos.jms.AtomikosTransactionRequiredJMSException

I'm trying to get the sample code from http://www.javaworld.com/javaworld/jw-04-2007/jw-04-xa.html to work with AtomikosTransactionsEssentials-3.7.0M5. I've switched the DB to Oracle 10.2 and am using ActiveMQ 5.4.1.

The Oracle configuration is working -- data is written and written to the database as long as the code that sends a JMS message is commented out.

When trying to send a message to a queue, the console first shows this error:
INFO-[2010-11-26 12:00:24,999][main][AtomikosConnectionFactoryBean 'EXECUTION_Q': createConnection()...][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:110)]
INFO-[2010-11-26 12:00:25,015][main][AtomikosConnectionFactoryBean 'EXECUTION_Q': init...][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:110)]
DEBUG-[2010-11-26 12:00:25,015][main][atomikos connection pool 'EXECUTION_Q': pool reached max size: 1][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:113)]
DEBUG-[2010-11-26 12:00:25,015][main][atomikos connection pool 'EXECUTION_Q': current size: 1/1][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:113)]
DEBUG-[2010-11-26 12:00:25,015][main][atomikos pooled connection for resource EXECUTION_Q: updating last time acquired][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:113)]
INFO-[2010-11-26 12:00:25,062][main][atomikos connection proxy for resource EXECUTION_Q: calling toString on JMS driver...][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:110)]
DEBUG-[2010-11-26 12:00:25,062][main][atomikos connection proxy for resource EXECUTION_Q: toString returning ActiveMQConnection {id=ID:hdq-d-jeisens2-3606-1290790804568-0:0,clientId=null,started=false}][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:113)]
DEBUG-[2010-11-26 12:00:25,062][main][atomikos pooled connection for resource EXECUTION_Q: returning proxy ActiveMQConnection {id=ID:hdq-d-jeisens2-3606-1290790804568-0:0,clientId=null,started=false}][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:113)]
DEBUG-[2010-11-26 12:00:25,062][main][atomikos connection pool 'EXECUTION_Q': got connection from pool, new size: 0/1][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:113)]
INFO-[2010-11-26 12:00:25,077][main][atomikos connection proxy for resource EXECUTION_Q: calling toString on JMS driver...][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:110)]
DEBUG-[2010-11-26 12:00:25,077][main][atomikos connection proxy for resource EXECUTION_Q: toString returning ActiveMQConnection {id=ID:hdq-d-jeisens2-3606-1290790804568-0:0,clientId=null,started=false}][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:113)]
DEBUG-[2010-11-26 12:00:25,077][main][AtomikosConnectionFactoryBean 'EXECUTION_Q': createConnection() returning ActiveMQConnection {id=ID:hdq-d-jeisens2-3606-1290790804568-0:0,clientId=null,started=false}][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:113)]
DEBUG-[2010-11-26 12:00:25,077][main][getCompositeTransaction() returning NULL!][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:113)]
INFO-[2010-11-26 12:00:25,077][main][atomikos connection proxy for resource EXECUTION_Q: creating XA-capable session...][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:110)]
DEBUG-[2010-11-26 12:00:25,093][main][JMS: driver complains while enforcing XA mode - ignore if no later errors:
javax.jms.TransactionInProgressException: Cannot rollback() inside an XASession
    at org.apache.activemq.ActiveMQXASession.rollback(ActiveMQXASession.java:76)
    at com.atomikos.jms.AtomikosJmsConnectionProxy.forceConnectionIntoXaMode(AtomikosJmsConnectionProxy.java:70)
    at com.atomikos.jms.AtomikosJmsConnectionProxy.invoke(AtomikosJmsConnectionProxy.java:161)
    at $Proxy2.createSession(Unknown Source)
    at org.springframework.jms.support.JmsAccessor.createSession(JmsAccessor.java:196)
    at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:462)
    at org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:539)
    at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:617)
    at org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:609)
    at com.findonnet.messaging.EventHandler.handleEvent(EventHandler.java:77)
    at com.findonnet.messaging.MainApp.main(MainApp.java:85)
][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:113)]

later, this warning is written:

WARN-[2010-11-26 12:00:25,233][main][The JMS session you are using requires a JTA transaction context for the calling thread and none was found.
Please correct your code to do one of the following:
1. start a JTA transaction if you want your JMS operations to be subject to JTA commit/rollback, or
2. increase the maxPoolSize of the AtomikosConnectionFactoryBean to avoid transaction timeout while waiting for a connection, or
3. create a non-transacted session and do session acknowledgment yourself, or
4. set localTransactionMode to true so connection-level commit/rollback are enabled.][-atomikos][com.atomikos.diagnostics.Slf4jConsole.println(Slf4jConsole.java:107)]

The spring config includes:

    <bean id="eventHandler" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
        <property name="transactionManager"><ref bean="transactionManager" /></property>
        <property name="target"><ref bean="eventHandlerTarget"  /></property>
        <property name="transactionAttributes">
            <props>
                <prop key="*">PROPAGATION_REQUIRED,-Exception</prop>
            </props>
        </property>
    </bean>

and this seems good enough for the database portions of the transaction.

Any insights would be appreciated.
Jane Eisenstein Send private email
Friday, November 26, 2010
 
 
There is no current transaction - either you didn't create one or it has timed out already.

Solution:

-check to make sure transactions are created
-increase the timeout for the transaction

HTH
Guy Pardon Send private email
Saturday, November 27, 2010
 
 
Adding these tags fixed the problem:

<aop:aspectj-autoproxy/>
<tx:annotation-driven transaction-manager="springTransactionManager" />
Jane Eisenstein Send private email
Sunday, November 28, 2010
 
 
Jane,

Thanks for the update!
Guy Pardon Send private email
Monday, November 29, 2010
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics