[jboss-user] [MQ] - JmsXA and remote queues

rlamie do-not-reply at jboss.com
Wed Oct 21 13:14:54 EDT 2009


Env : JBoss 4.2.3, JbossMQ shipped with Jboss 4.2.3

Hi all,
I have a pretty simple question, but dont manage to find the solution through google/forum searchs.

Inside an MDB, I need to enlist the sending of JMS messages in a JTA transaction. The queue is a remote queue located on another JBossMQ server.
The need to enlist in a JTA transaction with multiples resources decided me to turn to JmsXA pool.

Here is the code : 

  | @MessageDriven(
  | 		activationConfig = {...}...
  | @PoolClass (value=org.jboss.ejb3.StrictMaxPool.class, maxSize=1, timeout=30000)
  | @Depends("jboss.j2ee:service=EARDeployment,url='xxx.ear'")
  | public class Test1MDB implements MessageListener {
  | 	public void onMessage(Message msg) {
  |                 ... do operations on database (XADataSource)
  | 
  |                    Context jndi = new InitialContext();
  |                    QueueConnection connection = (QueueConnectionFactory) jndi.lookup("java:JmsXA");
  | 		  QueueSession = connection.createQueueSession(true, QueueSession.AUTO_ACKNOWLEDGE);
  |                   Queue queue = (Queue) jndi.lookup("jnp://174.54.12.144:1099/queue/test2");
  | 		  QueueSender sender = session.createSender(queue);
  | 		 ObjectMessage msg = MessageHelper.create(session, messageDTO);
  | 			sender.send(msg);
  |                        ...
  |             }
  | 

The result is that code works well if I target a local queue, but fails when I target a remote queue (like in my example). I add that the queues targeted are test queues (created temporarly by the MDB)

The following logs appear at the end of the onMessage method (commit time) :

  | 16:53:40,413 WARN  [loggerI18N] [com.arjuna.ats.internal.jta.resources.arjunacore.preparefailed] [com.arjuna.ats.internal.jta.resources.arjunacore.preparefailed] XAResourceRecord.prepare - prepare failed with exception XAException.XAER_RMFAIL
  | 16:53:40,416 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_50] - Prepare phase of action 7f000101:81ea:4adf0cd5:1255 received heuristic decision: TwoPhaseOutcome.HEURISTIC_HAZARD
  | 16:53:40,416 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_36] - BasicAction.End() - prepare phase of action-id 7f000101:81ea:4adf0cd5:1255 failed.
  | 16:53:40,416 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_37] - Received heuristic: TwoPhaseOutcome.HEURISTIC_HAZARD .
  | 16:53:40,416 WARN  [arjLoggerI18N] [com.arjuna.ats.arjuna.coordinator.BasicAction_38] - Action Aborting
  | 

And it chains to replay the same input message, until the following exception occurs :

  | 16:53:40,449 ERROR [JmsServerSession] org.jboss.resource.adapter.jms.inflow.JmsServerSession at 1c7811a failed to commit/rollback
  | javax.transaction.HeuristicMixedException
  | 	at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1397)
  | 	at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
  | 	at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
  | 	at org.jboss.resource.adapter.jms.inflow.JmsServerSession$XATransactionDemarcationStrategy.end(JmsServerSession.java:494)
  | 	at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:248)
  | 	at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
  | 	at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
  | 	at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:756)
  | 	at java.lang.Thread.run(Thread.java:595)
  | 

Strangely, that occurs only for remote queues.
Any pointers?
Thank you for your help.
RL

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4261554#4261554

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4261554



More information about the jboss-user mailing list