activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stevenmaring <steve.mar...@gmail.com>
Subject Cannot rollback() inside an XASession
Date Tue, 16 Jun 2009 17:01:32 GMT

I'm trying to use ActiveMQ with XA and a Spring configuration.  I'm now at
the point where DefaultMessageListenerContainer seems to be confusing local
and global transactions ...

12:37:58,173  WARN PooledSession:112 - Caught exception trying rollback()
when putting session back into the pool:
javax.jms.TransactionInProgressException: Cannot rollback() inside an
XASession
javax.jms.TransactionInProgressException: Cannot rollback() inside an
XASession
	at
org.apache.activemq.ActiveMQXASession.rollback(ActiveMQXASession.java:76)
	at org.jencks.amqpool.PooledSession.close(PooledSession.java:109)
	at
org.jencks.amqpool.XaConnectionPool$Synchronization.afterCompletion(XaConnectionPool.java:89)
	at
bitronix.tm.BitronixTransaction.fireAfterCompletionEvent(BitronixTransaction.java:382)
	at bitronix.tm.BitronixTransaction.rollback(BitronixTransaction.java:220)
	at
bitronix.tm.BitronixTransactionManager.rollback(BitronixTransactionManager.java:105)
	at
org.springframework.transaction.jta.JtaTransactionManager.doRollback(JtaTransactionManager.java:1054)
	at
org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:800)
	at
org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:777)
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.rollbackOnException(AbstractPollingMessageListenerContainer.java:385)
	at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:944)
	at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:875)
	at java.lang.Thread.run(Thread.java:595)


Honestly, I'm not even sure why it is trying to do transactions at this
point because there is nothing in the queues.

here is my Spring config:

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jaxws="http://cxf.apache.org/jaxws"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:amq="http://activemq.apache.org/schema/core"
       xmlns:jms="http://www.springframework.org/schema/jms"
       xsi:schemaLocation="
       http://www.springframework.org/schema/beans 
       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://cxf.apache.org/jaxws
       http://cxf.apache.org/schemas/jaxws.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
       http://www.springframework.org/schema/tx
       http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
       http://activemq.apache.org/schema/core
       http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd
       http://www.springframework.org/schema/jms
       http://www.springframework.org/schema/jms/spring-jms-2.5.xsd">

	<import resource="classpath:META-INF/cxf/cxf.xml" />
	<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />  
	

	<jaxws:endpoint
		id="voiceRequest"
		implementor="com.ess.tts.voicerequest.VoiceRequestImpl"
		address="/voiceRequest"
	/>
	

  	<amq:broker useJmx="false">
  		<amq:persistenceAdapter>
    		<amq:journaledJDBC dataDirectory="amq"/>
    	</amq:persistenceAdapter>
    	<amq:transportConnectors>
      		<amq:transportConnector uri="tcp://localhost:0" />
    	</amq:transportConnectors>
  	</amq:broker>
  	
    <amq:systemUsage>
        <amq:memoryUsage>
            <amq:memoryUsage limit="20 mb"/>
        </amq:memoryUsage>
        <amq:storeUsage>
            <amq:storeUsage limit="1 gb"/>
        </amq:storeUsage>
        <amq:tempUsage>
            <amq:tempUsage limit="100 mb"/>
        </amq:tempUsage>
    </amq:systemUsage>


  	<amq:queue id="amqRequestQueue"  physicalName="amqRequestQueue"/>
  	<amq:queue id="amqResponseQueue"  physicalName="amqResponseQueue"/>

    
    <bean id="jmsConnectionFactory"
		class="org.jencks.amqpool.XaPooledConnectionFactory">
		<property name="connectionFactory" ref="jmsFactory" />
		<property name="transactionManager" ref="bitronixTransactionManager" />
	</bean>
    
    <bean id="jmsFactory"
		class="org.apache.activemq.spring.ActiveMQXAConnectionFactory">
		<property name="brokerURL" value="vm://localhost" />
		<property name="prefetchPolicy">
			<bean class="org.apache.activemq.ActiveMQPrefetchPolicy">
				<property name="queuePrefetch" value="1" />
			</bean>
		</property>
		<property name="redeliveryPolicy">
			<bean class="org.apache.activemq.RedeliveryPolicy">
				<property name="initialRedeliveryDelay" value="60000" />
				<property name="backOffMultiplier" value="2" />
				<property name="useExponentialBackOff" value="true" />
				<property name="maximumRedeliveries" value="3" />
			</bean>
		</property>
	</bean>


 	
 	<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
 		<property name="connectionFactory" ref="jmsConnectionFactory"/>
 	</bean>
 	
 	<bean id="voiceRequestImpl"
class="com.ess.tts.voicerequest.VoiceRequestImpl">
 		<property name="jmsTemplate" ref="jmsTemplate"/>
 		<property name="requestQueue" ref="amqRequestQueue"/>
 	</bean>
 	
 	<bean id="voiceRequestConsumer"
class="com.ess.tts.voicerequest.queue.VoiceRequestConsumer">
 		<property name="jmsTemplate" ref="jmsTemplate"/>
 		<property name="responseQueue" ref="amqResponseQueue"/>
 	</bean>
 	

 	<bean id="btmConfig"
 		factory-method="getConfiguration"
 		class="bitronix.tm.TransactionManagerServices">
		<property name="serverId" value="spring-btm" />
	</bean>

	<bean id="bitronixTransactionManager"
		factory-method="getTransactionManager"
		class="bitronix.tm.TransactionManagerServices"
		depends-on="btmConfig"
		destroy-method="shutdown" />
	
 	<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
		<property name="transactionManager" ref="bitronixTransactionManager" />
		<property name="userTransaction" ref="bitronixTransactionManager" />
	</bean>
	
	<aop:aspectj-autoproxy/>
	
	<tx:advice id="txAdvice" transaction-manager="transactionManager">  
		<tx:attributes>  
			<tx:method name="*" propagation="REQUIRED" />  
		</tx:attributes>  
	</tx:advice>  

	<aop:config>  
		<aop:pointcut
			id="voiceRequestSender"
			expression="execution(String
com.ess.tts.voicerequest.VoiceRequestImpl.submitVoiceRequest(..))" />
		<aop:pointcut
			id="messageReceptionOperations"
			expression="execution(void com.ess.tts..*.onMessage(..)) and
target(javax.jms.MessageListener)" />
		<aop:advisor advice-ref="txAdvice" pointcut-ref="voiceRequestSender" /> 
		<aop:advisor advice-ref="txAdvice"
pointcut-ref="messageReceptionOperations" />
	</aop:config> 

	<bean id="voiceResponseConsumer"
class="com.ess.tts.voiceresponse.queue.VoiceResponseConsumer" />

	<jms:listener-container
		concurrency="1-5"
		destination-type="queue"
		prefetch="1"
		transaction-manager="transactionManager"
		connection-factory="jmsConnectionFactory">
		<jms:listener
			destination="amqRequestQueue"
			ref="voiceRequestConsumer"/>
		<jms:listener
			destination="amqResponseQueue"
			ref="voiceResponseConsumer"/>
	</jms:listener-container>
</beans>


Thanks,
Steve Maring
-- 
View this message in context: http://www.nabble.com/Cannot-rollback%28%29-inside-an-XASession-tp24058620p24058620.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message