You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Jingyang Peng <ji...@yahoo.com> on 2006/08/02 18:12:44 UTC

Neither rollback nor redeliver the message

Neither rollback nor redeliver the message when the listener got a
RuntimeException

Software: Activemq 4.0.1 + Jencks 1.1.1+ Spring 1.2.8  

AFAIK, the middleware or JMS container should take care of the JMS/XA
transaction as well as the message acknowledgements or redeliver. It works
fine in success scenario. I could see the XA transaction start, message
process and transaction commit. 

In the sad-path scenarios, I want to treat any uncheck exception as a
transient error and retry the message again. Somehow, I failed; I could not
see the transaction rollback neither the message redelivered.

Thanks
Jingyang Peng	   


Log and Stack Trance:

2006-08-02 11:47:02,629 [main           ] INFO  JCAConnector                  
- Activating endpoint for activationSpec:
ActiveMQActivationSpec{acknowledgeMode='Auto-acknowledge',
destinationType='javax.jms.Queue', messageSelector='null',
destination='net.autodata.salespro.evid.ExtractQueue', clientId='null',
subscriptionName='null', subscriptionDurability='NonDurable'} using
endpointFactory:
org.jencks.DefaultEndpointFactory@47a0d4[transactionManager=org.apache.geronimo.transaction.context.GeronimoTransactionManager@8ff4cf]
2006-08-02 11:47:02,644 [main           ] DEBUG ActiveMQEndpointWorker        
- Starting
2006-08-02 11:47:02,644 [main           ] DEBUG ActiveMQEndpointWorker        
- Started
2006-08-02 11:47:02,660 [main           ] INFO  JCAConnector                  
- Activating endpoint for activationSpec:
ActiveMQActivationSpec{acknowledgeMode='Auto-acknowledge',
destinationType='javax.jms.Queue', messageSelector='null',
destination='net.autodata.salespro.evid.LoadQueue', clientId='null',
subscriptionName='null', subscriptionDurability='NonDurable'} using
endpointFactory:
org.jencks.DefaultEndpointFactory@109de5b[transactionManager=org.apache.geronimo.transaction.context.GeronimoTransactionManager@8ff4cf]
2006-08-02 11:47:02,660 [main           ] DEBUG ActiveMQEndpointWorker        
- Starting
2006-08-02 11:47:02,660 [main           ] DEBUG ActiveMQEndpointWorker        
- Started
2006-08-02 11:47:02,660 [main           ] INFO  JCAContainer                  
- Jencks JCA Container (http://jencks.org/) has started running version:
1.1.1
...
2006-08-02 11:47:03,363 [main           ] DEBUG ActiveMQSession               
- Sending message: ActiveMQTextMessage {commandId = 0, responseRequired =
false, messageId = ID:PengP-XP-1941-1154533622941-1:2:1:1:1,
originalDestination = null, originalTransactionId = null, producerId =
ID:PengP-XP-1941-1154533622941-1:2:1:1, destination =
queue://net.autodata.salespro.evid.LoadQueue, transactionId = null,
expiration = 0, timestamp = 1154533623347, arrival = 0, correlationId =
null, replyTo = null, persistent = true, type = null, priority = 4, groupID
= null, groupSequence = 0, targetConsumerId = null, compressed = false,
userID = null, content = null, marshalledProperties = null, dataStructure =
null, redeliveryCounter = 0, size = 0, properties = {pathName=},
readOnlyProperties = true, readOnlyBody = true, text = Wed Aug 02 11:47:03
EDT 2006}
2006-08-02 11:47:03,394 [127.0.0.1:61616] DEBUG ServerSessionPoolImpl         
- ServerSession requested.
2006-08-02 11:47:03,410 [127.0.0.1:61616] DEBUG ServerSessionPoolImpl         
- Created a new session: ServerSessionImpl:0
2006-08-02 11:47:03,410 [127.0.0.1:61616] DEBUG ServerSessionImpl:0           
- Starting run.
2006-08-02 11:47:03,410 [127.0.0.1:61616] DEBUG ServerSessionImpl:0           
- Work accepted:
javax.resource.spi.work.WorkEvent[source=org.apache.geronimo.connector.work.GeronimoWorkManager@7f58ef]
2006-08-02 11:47:03,410 [Thread-4       ] DEBUG ServerSessionImpl:0           
- Work started: javax.resource.spi.work.WorkEvent[source=Work
:ServerSessionImpl:0]
2006-08-02 11:47:03,410 [Thread-4       ] DEBUG ServerSessionImpl:0           
- Running
2006-08-02 11:47:03,410 [Thread-4       ] DEBUG ServerSessionImpl:0           
- run loop start
2006-08-02 11:47:03,441 [Thread-4       ] DEBUG TransactionContext            
- Start:
[globalId=100000005748415420444f2057452043414c4c2049543f0000000000000000000000000000000000000,branchId=100000005748415420444f2057452043414c4c2049543f0000000000000000000000000000000000000]
2006-08-02 11:47:03,472 [Thread-4       ] DEBUG TransactionContext            
- Started XA transaction:
XID:1197822575:01000000000000005748415420444f2057452043414c4c2049543f00000000000000000000000000000000000000000000000000000000000000000000000000:01000000000000005748415420444f2057452043414c4c2049543f00000000000000000000000000000000000000000000000000000000000000000000000000
2006-08-02 11:47:03,472 [Thread-4       ] DEBUG XAEndpoint                    
- Transaction started and resource enlisted
2006-08-02 11:47:03,472 [Thread-4       ] DEBUG LoadInventoryListener         
- starts onMessage...
2006-08-02 11:47:03,472 [Thread-4       ] DEBUG LoadInventoryListener         
- ActiveMQTextMessage {commandId = 5, responseRequired = true, messageId =
ID:PengP-XP-1941-1154533622941-1:2:1:1:1, originalDestination = null,
originalTransactionId = null, producerId =
ID:PengP-XP-1941-1154533622941-1:2:1:1, destination =
queue://net.autodata.salespro.evid.LoadQueue, transactionId = null,
expiration = 0, timestamp = 1154533623363, arrival = 0, correlationId =
null, replyTo = null, persistent = true, type = null, priority = 4, groupID
= null, groupSequence = 0, targetConsumerId = null, compressed = false,
userID = null, content = org.apache.activeio.packet.ByteSequence@a53de4,
marshalledProperties = org.apache.activeio.packet.ByteSequence@827968,
dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
readOnlyProperties = true, readOnlyBody = true, text = null}
2006-08-02 11:47:03,504 [Thread-4       ] ERROR EvidTransformer               
- error transforming xml: 
java.io.FileNotFoundException: c:\temp\download\stage_01_insert\transformer
(Access is denied)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
	…
	at LoadInventoryListener.onMessage(LoadInventoryListener.java:92)
	at org.jencks.XAEndpoint.onMessage(XAEndpoint.java:126)
	at
org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:120)
	at
org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:60)
	at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:692)
	at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:163)
	at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
	at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:727)
	at java.lang.Thread.run(Thread.java:595)
2006-08-02 11:47:03,504 [Thread-4       ] ERROR ActiveMQSession               
- error dispatching message: 
…
	at LoadInventoryListener.onMessage(LoadInventoryListener.java:92)
	at org.jencks.XAEndpoint.onMessage(XAEndpoint.java:126)
	at
org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:120)
	at
org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:60)
	at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:692)
	at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:163)
	at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
	at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:727)
	at java.lang.Thread.run(Thread.java:595)
Caused by: java.io.FileNotFoundException:
c:\temp\download\stage_01_insert\transformer (Access is denied)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
	... 10 more
2006-08-02 11:47:03,535 [Thread-4       ] DEBUG ServerSessionImpl:0           
- run loop end
2006-08-02 11:47:03,535 [127.0.0.1:61616] DEBUG ActiveMQEndpointWorker        
- Reconnect cause: 
javax.jms.JMSException: c:\temp\download\stage_01_insert\transformer (Access
is denied)
	at
org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:45)
	at
org.apache.activemq.ActiveMQConnection.onAsyncException(ActiveMQConnection.java:1443)
	at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:696)
	at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:163)
	at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
	at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:727)
	at java.lang.Thread.run(Thread.java:595)
Caused by: …
	at LoadInventoryListener.onMessage(LoadInventoryListener.java:92)
	at org.jencks.XAEndpoint.onMessage(XAEndpoint.java:126)
	at
org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:120)
	at
org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:60)
	at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:692)
	... 4 more
Caused by: java.io.FileNotFoundException:
            …
	... 10 more
2006-08-02 11:47:03,535 [Thread-4       ] DEBUG ServerSessionPoolImpl         
- Session returned to pool: ServerSessionImpl:0
2006-08-02 11:47:03,535 [Thread-4       ] DEBUG ServerSessionImpl:0           
- Run finished
2006-08-02 11:47:03,535 [Thread-4       ] DEBUG ServerSessionImpl:0           
- Work completed: javax.resource.spi.work.WorkEvent[source=Work
:ServerSessionImpl:0]
2006-08-02 11:47:04,550 [Thread-6       ] DEBUG WireFormatNegotiator          
- Sending: WireFormatInfo { version=1,
properties={TightEncodingEnabled=true, TcpNoDelayEnabled=true,
SizePrefixDisabled=false, StackTraceEnabled=true,
MaxInactivityDuration=30000, CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
2006-08-02 11:47:04,550 [127.0.0.1:61616] DEBUG TcpTransport                  
- TCP consumer thread starting
2006-08-02 11:47:04,550 [127.0.0.1:61616] DEBUG WireFormatNegotiator          
- Received WireFormat: WireFormatInfo { version=1,
properties={StackTraceEnabled=true, TightEncodingEnabled=true,
TcpNoDelayEnabled=true, SizePrefixDisabled=false,
MaxInactivityDuration=30000, CacheEnabled=true}, magic=[A,c,t,i,v,e,M,Q]}
2006-08-02 11:47:04,550 [127.0.0.1:61616] DEBUG WireFormatNegotiator          
- tcp://localhost/127.0.0.1:61616 before negotiation:
OpenWireFormat{version=1, cacheEnabled=false, stackTraceEnabled=false,
tightEncodingEnabled=false, sizePrefixDisabled=false}

Configuration snippet:

 Spring-jencks-xa.xml 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd" >
<beans>
	
	<!-- 
		###### Transaction manager  ######
	-->
	<bean id="transactionContextManager"
		class="org.jencks.factory.TransactionContextManagerFactoryBean" />
	<bean id="userTransaction"
		class="org.jencks.factory.GeronimoTransactionManagerFactoryBean" />
	<bean id="jtaTransactionManager"
		class="org.springframework.transaction.jta.JtaTransactionManager">
		<property name="userTransaction" ref="userTransaction" />
	</bean>
	
	<!-- 
		###### JMS ######
	-->
	<bean id="activeMQResourceAdapter"
		class="org.apache.activemq.ra.ActiveMQResourceAdapter">
		<!--    <property name="serverUrl" value="vm://EvidBroker" />-->
		<property name="serverUrl" value="tcp://localhost:61616" />
		<property name="maximumRedeliveries" value="3"></property>
		<property name="initialRedeliveryDelay" value="100"></property>
	</bean>

	<!-- 
		###### JCA Container ######
	-->
	<bean id="jencks" class="org.jencks.JCAContainer">
		<!-- lets use the default configuration of work manager and transaction
manager -->
		<property name="bootstrapContext">
			<bean
				class="org.jencks.factory.BootstrapContextFactoryBean">
				<property name="threadPoolSize" value="25" />
			</bean>
		</property>
		<!-- the JCA Resource Adapter -->
		<property name="resourceAdapter" ref="activeMQResourceAdapter" />
	</bean>
	
	<!-- 
		###### JCA ######
	-->	
	<bean id="jmsManagedConnectionFactory"
		class="org.apache.activemq.ra.ActiveMQManagedConnectionFactory">
		<property name="resourceAdapter">
			<ref bean="activeMQResourceAdapter" />
		</property>
	</bean>
	<bean id="jmsConnectionFactory"
		class="org.springframework.jca.support.LocalConnectionFactoryBean">
		<property name="managedConnectionFactory"
			ref="jmsManagedConnectionFactory" />
		<property name="connectionManager" ref="connectionManager" />
	</bean>
	
	<bean id="connectionManager"
		class="org.jencks.factory.ConnectionManagerFactoryBean">
		<property name="transactionSupport" ref="transactionSupport" />
		<property name="poolingSupport" ref="poolingSupport" />
	</bean>
	
	<bean id="transactionSupport"
		class="org.jencks.factory.XATransactionFactoryBean">
		<property name="useTransactionCaching" value="true" />
		<property name="useThreadCaching" value="false" />
	</bean>
	
	<bean id="poolingSupport"
		class="org.jencks.factory.SinglePoolFactoryBean">
		<property name="maxSize" value="10" />
		<property name="minSize" value="0" />
		<property name="blockingTimeoutMilliseconds" value="60" />
		<property name="idleTimeoutMinutes" value="1" />
		<property name="matchOne" value="true" />
		<property name="matchAll" value="true" />
		<property name="selectOneAssumeMatch" value="true" />
	</bean>

</beans>

Spring-listeners.xml

	<bean id="inboundConnectorLoadEvid"
		class="org.jencks.JCAConnector">
		<property name="jcaContainer" ref="jencks" />
		<!-- subscription details -->
		<property name="activationSpec">
			<bean
				class="org.apache.activemq.ra.ActiveMQActivationSpec">
				<property name="destination"
					value="net.autodata.salespro.evid.LoadQueue" />
				<property name="destinationType"
					value="javax.jms.Queue" />
			</bean>
		</property>
		<!-- use XA transactions -->
		<property name="transactionManager" ref="userTransaction" />
		<property name="ref" value="loadEvidQueueListener" />
	</bean>
	<bean id="loadEvidQueueListener"
		class="LoadInventoryListener">
		……
	</bean>

-- 
View this message in context: http://www.nabble.com/Neither-rollback-nor-redeliver-the-message-tf2040790.html#a5617084
Sent from the ActiveMQ - User forum at Nabble.com.