Mantis - Resin
Viewing Issue Advanced Details
2627 minor always 04-25-08 14:10 06-12-08 17:10
ferg  
ferg  
normal  
closed 3.1.6  
fixed  
none    
none 3.2.0  
0002627: ActiveMQ transation
(rep by wesley)

As I'm using ActiveMQ jca adapter on snapshot080331, eventually when producing messages it will throw exceptions.
My message sender:
==================================================
 @Named("clearCache")
 Topic clearCacheTopic;
 @In
 ConnectionFactory jmsFactory;
 public void sendClearCacheMessage() {
  Connection conn = null;
  try {
   conn = jmsFactory.createConnection();
   Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
   MessageProducer producer = session.createProducer(clearCacheTopic);
   producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
   producer.send(session.createTextMessage("Clear cache at " + DateUtils.toDateTimeString(new Date())));
  } catch (JMSException e) {
   log.warn(StringUtils.stackTraceAsString(e));
  } finally {
   try {
    conn.close();
   } catch (Throwable ignore) {
   }
  }
 }
=====================================================================
resin-web.xml
=====================================================================
 <resource-adapter uri="activemq:">
  <init server-url="tcp://192.168.1.100:61616"/> [^]
 </resource-adapter>
 <connection-factory uri="activemq:" name="activemq"/>
 <jms-topic uri="activemq:" name="clearCache">
  <init physicalName="topic.clearCache"/>
 </jms-topic>
 <ejb-message-bean class="com.buysou.cache.ClearCacheListener">
  <destination>#{clearCache}</destination>
 </ejb-message-bean>
=====================================================================
ActiveMQ config is at default.
 
Is there any trick to prevent this exceptions?
 
-Wesley
 
stacktrace:
 
[15:36:37.941] {ActiveMQ Session Task} javax.resource.ResourceException: begin failed.
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.LocalAndXATransaction.begin(LocalAndXATransaction.java:52)
[15:36:37.941] {ActiveMQ Session Task} at com.caucho.jca.PoolItem.localTransactionStarted(PoolItem.java:546)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.ActiveMQManagedConnection.fireBeginEvent(ActiveMQManagedConnection.java:151)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.ActiveMQManagedConnection.access$100(ActiveMQManagedConnection.java:55)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.ActiveMQManagedConnection$2.beginEvent(ActiveMQManagedConnection.java:94)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.TransactionContext.begin(TransactionContext.java:204)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.LocalAndXATransaction.begin(LocalAndXATransaction.java:49)
[15:36:37.941] {ActiveMQ Session Task} at com.caucho.jca.PoolItem.localTransactionStarted(PoolItem.java:546)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.ActiveMQManagedConnection.fireBeginEvent(ActiveMQManagedConnection.java:151)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.ActiveMQManagedConnection.access$100(ActiveMQManagedConnection.java:55)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.ActiveMQManagedConnection$2.beginEvent(ActiveMQManagedConnection.java:94)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.TransactionContext.begin(TransactionContext.java:204)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.ManagedTransactionContext.begin(ManagedTransactionContext.java:56)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ActiveMQSession.doStartTransaction(ActiveMQSession.java:1658)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ActiveMQMessageConsumer.ackLater(ActiveMQMessageConsumer.java:782)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ActiveMQMessageConsumer.beforeMessageIsConsumed(ActiveMQMessageConsumer.java:728)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:963)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:122)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:192)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
[15:36:37.941] {ActiveMQ Session Task} at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[15:36:37.941] {ActiveMQ Session Task} at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[15:36:37.941] {ActiveMQ Session Task} at java.lang.Thread.run(Thread.java:619)
[15:36:37.941] {ActiveMQ Session Task} Caused by: javax.jms.JMSException: The resource is allready being used in transaction context.
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.ManagedTransactionContext.setUseSharedTxContext(ManagedTransactionContext.java:47)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.ManagedSessionProxy.setUseSharedTxContext(ManagedSessionProxy.java:65)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.ManagedConnectionProxy.setUseSharedTxContext(ManagedConnectionProxy.java:125)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.ActiveMQManagedConnection$1.setInManagedTx(ActiveMQManagedConnection.java:87)
[15:36:37.941] {ActiveMQ Session Task} at org.apache.activemq.ra.LocalAndXATransaction.begin(LocalAndXATransaction.java:50)
[15:36:37.941] {ActiveMQ Session Task} ... 23 more
[15:36:37.945] {ActiveMQ Session Task} javax.resource.ResourceException: begin failed.
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ra.LocalAndXATransaction.begin(LocalAndXATransaction.java:52)
[15:36:37.945] {ActiveMQ Session Task} at com.caucho.jca.PoolItem.localTransactionStarted(PoolItem.java:546)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ra.ActiveMQManagedConnection.fireBeginEvent(ActiveMQManagedConnection.java:151)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ra.ActiveMQManagedConnection.access$100(ActiveMQManagedConnection.java:55)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ra.ActiveMQManagedConnection$2.beginEvent(ActiveMQManagedConnection.java:94)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.TransactionContext.begin(TransactionContext.java:204)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ra.ManagedTransactionContext.begin(ManagedTransactionContext.java:56)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ActiveMQSession.doStartTransaction(ActiveMQSession.java:1658)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ActiveMQMessageConsumer.ackLater(ActiveMQMessageConsumer.java:782)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ActiveMQMessageConsumer.beforeMessageIsConsumed(ActiveMQMessageConsumer.java:728)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:963)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:122)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:192)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:122)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:43)
[15:36:37.945] {ActiveMQ Session Task} at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[15:36:37.945] {ActiveMQ Session Task} at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[15:36:37.945] {ActiveMQ Session Task} at java.lang.Thread.run(Thread.java:619)
[15:36:37.945] {ActiveMQ Session Task} Caused by: javax.jms.JMSException: The resource is allready being used in transaction context.
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ra.ManagedTransactionContext.setUseSharedTxContext(ManagedTransactionContext.java:47)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ra.ManagedSessionProxy.setUseSharedTxContext(ManagedSessionProxy.java:65)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ra.ManagedConnectionProxy.setUseSharedTxContext(ManagedConnectionProxy.java:125)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ra.ActiveMQManagedConnection$1.setInManagedTx(ActiveMQManagedConnection.java:87)
[15:36:37.945] {ActiveMQ Session Task} at org.apache.activemq.ra.LocalAndXATransaction.begin(LocalAndXATransaction.java:50)
[15:36:37.945] {ActiveMQ Session Task} ... 17 more


Notes
(0003191)
ferg   
06-12-08 17:10   
server/30c4