activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From miten <Miten.Me...@morganstanley.com>
Subject Re: xa jta activemq jboss
Date Thu, 26 Nov 2009 11:40:17 GMT

Hi,

Actually XAConnection is being setup fine but the session is not getting the
transaction attributes.
I also tried to ensure your suggestion to extend and override the
createConnectionFactory but does not solve the issue.  I am listing here the
application config (with Override) so that one can refer here if needed.

using derived class config:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
  
 
<!-- this is the Message Driven POJO (MDP) -->
<bean id="myMessageListener" class="jmsexample.ExampleListener" />
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
      <props>
        <prop key="java.naming.factory.initial">
          jmsexample.jndi.ActiveMQInitialContextFactory
        </prop>
        <prop key="queue.TEST.Q1">
          TEST.Q1
        </prop>
        
        <prop key="brokerURL">
           tcp://localhost:61616
        </prop>
      </props>
    </property>
  </bean>
 <bean id="appJmsDestination"
    class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate">
      <ref bean="jndiTemplate"/>
    </property>
    <property name="jndiName" value="TEST.Q1"/>
  </bean>
  
 <bean id="connectionFactory"
    class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiTemplate">
      <ref bean="jndiTemplate"/>
    </property>
    <property name="jndiName" value="ConnectionFactory"/>
  </bean>
 

<bean id="jmsContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    <property name="connectionFactory" ref="connectionFactory"/>
    <property name="destination" ref="appJmsDestination"/>
    <property name="messageListener" ref="myMessageListener" />
    <property name="transactionManager" ref="transactionManager"/>
    
</bean>

 
 <bean id="jbossTransactionManager"
   
class="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple">
  </bean>

  <bean id="jbossUserTransaction"
   
class="com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImple"/>

  <bean id="transactionManager"
    class="org.springframework.transaction.jta.JtaTransactionManager">
    <property name="transactionManager">
      <ref bean="jbossTransactionManager" />
    </property>
    <property name="userTransaction">
      <ref bean="jbossUserTransaction" />
    </property>
  </bean>
    
</beans>

I have opened issue as you suggested:
https://issues.apache.org/activemq/browse/AMQ-2514 AMQ-2514 

There are thus two bean configs in this thread viz. with and w/o deriving
ActiveMQInitialContextFactory.

Regards,

Miten.


Gary Tully wrote:
> 
> is the problem that the
> ActiveMQInitialContextFactory returns a regular connection factory rather
> than an XA capable one. You may want to extend the
> ActiveMQInitialContextFactory to override the createConnectionFactory()
> method to return an XA variant or see if you can explicitly provide the
> connection factory reference.
> Either through configuration of by default the createConnectionFactory
> should be capable of returning an XA connection factory. I think by defaut
> it would make sense. Can you raise a JIRA for this an if you find that
> this
> is the root cause of your problem.
> 
> 
> 2009/11/25 miten <Miten.Mehta@morganstanley.com>
> 
>>
>> Hi,
>>
>> I am able to get things to work without global transaction.  With JBOSS I
>> am
>> getting "javax.jms.JMSException: Session's XAResource has not been
>> enlisted
>> in a distributed transaction."
>>
>> using the spring config as below:
>> =========================
>> <bean id="myMessageListener" class="jmsexample.ExampleListener" />
>> <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
>>    <property name="environment">
>>      <props>
>>        <prop key="java.naming.factory.initial">
>>          org.apache.activemq.jndi.ActiveMQInitialContextFactory
>>        </prop>
>>        <prop key="queue.TEST.Q1">
>>          TEST.Q1
>>        </prop>
>>      </props>
>>    </property>
>>  </bean>
>>  <bean id="appJmsDestination"
>>    class="org.springframework.jndi.JndiObjectFactoryBean">
>>    <property name="jndiTemplate">
>>      <ref bean="jndiTemplate"/>
>>    </property>
>>    <property name="jndiName" value="TEST.Q1"/>
>>  </bean>
>> <bean id="connectionFactory"
>>      class="org.apache.activemq.ActiveMQXAConnectionFactory">
>>        <property name="brokerURL">
>>           <value>tcp://localhost:61616</value>
>>        </property>
>>    </bean>
>>
>>
>> <bean id="jmsContainer"
>> class="org.springframework.jms.listener.DefaultMessageListenerContainer">
>>    <property name="connectionFactory" ref="connectionFactory"/>
>>    <property name="destination" ref="appJmsDestination"/>
>>    <property name="messageListener" ref="myMessageListener" />
>>
>>
>>    <property name="transactionManager" ref="transactionManager"/>
>>
>> </bean>
>>
>>
>>  <bean id="jbossTransactionManager"
>>
>>
>> class="com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple">
>>  </bean>
>>
>>  <bean id="jbossUserTransaction"
>>
>>
>> class="com.arjuna.ats.internal.jta.transaction.arjunacore.UserTransactionImple"/>
>>
>>  <bean id="transactionManager"
>>    class="org.springframework.transaction.jta.JtaTransactionManager">
>>    <property name="transactionManager">
>>      <ref bean="jbossTransactionManager" />
>>    </property>
>>    <property name="userTransaction">
>>      <ref bean="jbossUserTransaction" />
>>    </property>
>>  </bean>
>>
>>
>> Regards,
>>
>> Miten.
>> --
>> View this message in context:
>> http://old.nabble.com/xa-jta-activemq-jboss-tp26515685p26515685.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> http://blog.garytully.com
> 
> Open Source Integration
> http://fusesource.com
> 
> 

-- 
View this message in context: http://old.nabble.com/xa-jta-activemq-jboss-tp26515685p26527052.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message