Hi

I'm working on a poc to where we want to use Activemq as our messagebroker
and Camel as routing engine deployed as war's in Weblogic.

Currently i'm trying integration options with our Weblogic Application
server and JTA using XA since we need it in senarius with different db
integrations.

The setup works ok with failover, redelivery, failure handling asf., but
when stopping/starting the Camel 
there is a problem when PolledConnectionFactory.stop is called causing the
Weblogic transactionmanager to declare the activemq transactioncontext as
unhealthy.

[.kernel.Default (self-tuning)'] PooledConnectionFactory        DEBUG
Stopping the PooledConnectionFactory, number of connections in cache: 0
[ thread #0 - JmsConsumer[demo]] WebLogicJtaTransactionManager  DEBUG
Initiating transaction commit
<21-03-2014 11:12:13 CET> <Warning> <JTA> <BEA-110484> <The JTA health state
has changed from HEALTH_OK to HEALTH_WARN with reason codes: Resource
org.apache.activemq.TransactionContext declared unhealthy.> 
<21-03-2014 11:12:13 CET> <Warning> <JTA> <BEA-110204> <XA resource
[org.apache.activemq.TransactionContext] returns XAER_RMFAIL and is
unavailable.> 
<21-03-2014 11:12:13 CET> <Warning> <JTA> <BEA-110405> <Resource
org.apache.activemq.TransactionContext was not assigned to any of these
servers: AdminServer > 
[

During startup DefaultJmsMessageListenerContainer will get another exception
while trying to establish connections.

Caused by: javax.transaction.SystemException: start() failed on resource
'org.apache.activemq.TransactionContext': XAER_RMFAIL : Resource manager is
unavailable
javax.transaction.xa.XAException: Internal error: XAResource
'org.apache.activemq.TransactionContext' is unavailable

The only way to recover is restarting the appserver so the
transactionmanager becomes available again.

I suspect it is a timing issue between JTA transactionmanager in WLS and the
cleanup thats done in the stop method. 

Stacktrace will be attached 

I have setup ActiveMq config as follows :

        <tx:jta-transaction-manager />
        
        <bean id="jmsTransactionManager" factory-bean="transactionManager"
factory-method="getTransactionManager"/>
        
        <bean id="jmsXaConnectionFactory"
class="org.apache.activemq.ActiveMQXAConnectionFactory">
        <property name="brokerURL" value="${broker-url}"/>
        <property name="redeliveryPolicy">    
            <bean class="org.apache.activemq.RedeliveryPolicy">
                <property name="maximumRedeliveries" value="-1"/>
            </bean>
        </property>
    </bean> 
        
         <bean id="jmsTxConfig"
class="org.apache.camel.component.jms.JmsConfiguration"> 
        <property name="connectionFactory"
ref="pooledJmsXaConnectionFactory"/> 
        <property name="transactionManager" ref="transactionManager"/> 
        <property name="transacted" value="false"/>
        <property name="cacheLevelName" value="CACHE_CONNECTION"/>
    </bean>  
        
        <bean id="pooledJmsXaConnectionFactory"
class="org.apache.activemq.pool.XaPooledConnectionFactory"
init-method="start" destroy-method="stop">
        <property name="maxConnections" value="1" />          
        <property name="connectionFactory" ref="jmsXaConnectionFactory" />
        <property name="transactionManager" ref="jmsTransactionManager"/>
    </bean>
     
    <bean id="resourceManager"
class="org.apache.activemq.pool.ActiveMQResourceManager"
init-method="recoverResource">
        <property name="transactionManager" ref="jmsTransactionManager" />
        <property name="connectionFactory" ref="jmsXaConnectionFactory" /> 
        <property name="resourceName" value="activemq.default" />
    </bean>
           
        <bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
                <property name="configuration" ref="jmsTxConfig" />
        </bean>

camel context


        <bean id="kaput" class="java.lang.RuntimeException" />

        <camelContext id="redelivery-Context"
xmlns="http://camel.apache.org/schema/spring";>
                <jmxAgent id="agent" createConnector="false" 
loadStatisticsEnabled="false"
/>
                <route id="redelivery-Route">
                        <from uri="activemq:queue:demo" />
                        <transacted/>
                        <to uri="mock:demoevent" />
                        <choice>
                                <when>
                                        <simple>${body} == 'bad'</simple>
                                        <throwException ref="kaput" />
                                </when>
                                <otherwise><to 
uri="activemq:queue:bar"/></otherwise>
                        </choice>
                </route>
         
        </camelContext>

Best regards
Preben



--
View this message in context: 
http://activemq.2283324.n4.nabble.com/PooledConnectionFactory-stop-causes-org-apache-activemq-TransactionContext-to-be-declared-unhealthy-tp4679399.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to