I try to implement the following pattern using an XA transaction

jms -> camel -> jms
              |
            JMS

All messages are commited correctly but I receive the following error before
the commit


log error
----------

02:10:50,405 | WARN  | tenerContainer-1 | TransactionManagerImpl           |
n.manager.TransactionManagerImpl  367 | Error calling transaction
association listener
java.lang.IllegalStateException: Already value
[org.springframework.jms.connection.jmsresourcehol...@dccc8b] for key
[org.apache.activemq.pool.jcapooledconnectionfact...@422309] bound to thread
[DefaultMessageListenerContainer-1]
        at
org.springframework.transaction.support.TransactionSynchronizationManager.bindResource(TransactionSynchronizationManager.java:182)
        at
org.springframework.transaction.support.ResourceHolderSynchronization.resume(ResourceHolderSynchronization.java:55)
        at
org.apache.servicemix.transaction.GeronimoPlatformTransactionManager$1.threadAssociated(GeronimoPlatformTransactionManager.java:97)
        at
org.apache.geronimo.transaction.manager.TransactionManagerImpl.fireThreadAssociated(TransactionManagerImpl.java:365)
        at
org.apache.geronimo.transaction.manager.TransactionManagerImpl.associate(TransactionManagerImpl.java:117)
        at
org.apache.geronimo.transaction.manager.TransactionManagerImpl.resume(TransactionManagerImpl.java:183)
        at sun.reflect.GeneratedMethodAccessor140.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:64)
        at
org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:78)
        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at
org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
        at
org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at
org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)
        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at
org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
        at
org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
        at
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        at $Proxy23.resume(Unknown Source)
        at
org.apache.servicemix.common.EndpointDeliveryChannel.resumeTx(EndpointDeliveryChannel.java:140)
        at
org.apache.servicemix.common.EndpointDeliveryChannel.sendSync(EndpointDeliveryChannel.java:123)
        at
org.apache.servicemix.common.endpoints.SimpleEndpoint.sendSync(SimpleEndpoint.java:74)
        at
org.apache.servicemix.jms.endpoints.AbstractConsumerEndpoint.onMessage(AbstractConsumerEndpoint.java:551)
        at
org.apache.servicemix.jms.endpoints.JmsConsumerEndpoint$1.onMessage(JmsConsumerEndpoint.java:505)
        at
org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:518)
        at
org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:479)
        at
org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:451)
        at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:323)
        at
org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:241)
        at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:982)
        at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:974)
        at
org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:876)
        at java.lang.Thread.run(Thread.java:619)
02:10:50,406 | DEBUG | tenerContainer-1 | SpringCamelContext               |
.camel.spring.SpringCamelContext  107 | Publishing spring-event:
org.springframework.osgi.service.importer.event.osgiservicedependencywaitstartingevent[source=org.springframework.osgi.service.importer.support.osgiserviceproxyfactoryb...@2f1f2b]
02:10:50,406 | DEBUG | tenerContainer-1 | SpringCamelContext               |
.camel.spring.SpringCamelContext  107 | Publishing spring-event:
org.springframework.osgi.service.importer.event.osgiservicedependencywaitendedevent[source=org.springframework.osgi.service.importer.support.osgiserviceproxyfactoryb...@2f1f2b]
02:10:50,407 | DEBUG | tenerContainer-1 | ActiveMQSession                  |
.apache.activemq.ActiveMQSession  504 |
ID:solaris-42062-1252448639837-2:50:1 Transaction Commit
:TX:ID:solaris-42062-1252448639837-2:50:3
02:10:50,407 | DEBUG | tenerContainer-1 | TransactionContext               |
ache.activemq.TransactionContext  274 | Commit:
TX:ID:solaris-42062-1252448639837-2:50:3 syncCount: 1
02:10:50,408 | DEBUG | /127.0.0.1:57850 | LocalTransaction                 |
emq.transaction.LocalTransaction   49 | commit:
TX:ID:solaris-42062-1252448639837-2:50:3 syncCount: 3
02:10:50,410 | DEBUG | ActiveMQ Task    | AMQMessageStore                  |
tivemq.store.amq.AMQMessageStore  370 | Doing batch update... adding: 0
removing: 1 
02:10:50,410 | DEBUG | ActiveMQ Task    | KahaReferenceStore               |
re.kahadaptor.KahaReferenceStore  219 | esb remove reference:
ID:imac-de-giampaolo-tranchida.local-61151-1252455052590-0:0:1:1:1
02:10:50,410 | DEBUG | ActiveMQ Task    | AMQMessageStore                  |
tivemq.store.amq.AMQMessageStore  418 | Batch update done.
02:10:50,411 | DEBUG | tenerContainer-1 | SpringCamelContext               |
.camel.spring.SpringCamelContext  107 | Publishing spring-event:
org.springframework.osgi.service.importer.event.osgiservicedependencywaitstartingevent[source=org.springframework.osgi.service.importer.support.osgiserviceproxyfactoryb...@2f1f2b]
02:10:50,412 | DEBUG | tenerContainer-1 | SpringCamelContext               |
.camel.spring.SpringCamelContext  107 | Publishing spring-event:
org.springframework.osgi.service.importer.event.osgiservicedependencywaitendedevent[source=org.springframework.osgi.service.importer.support.osgiserviceproxyfactoryb...@2f1f2b]
02:10:50,412 | DEBUG | tenerContainer-1 | JtaTransactionManager            |
stractPlatformTransactionManager  730 | Initiating transaction commit
02:10:50,413 | DEBUG | tenerContainer-1 | TransactionContext               |
ache.activemq.TransactionContext  333 | End:
[globalId=ffffffd914000000ffffffc8ffffff99691ffffffc0ffffffa8114000000000000000000000000000000000000000000000000,branchId=10000000ffffffc8ffffff99691ffffffc0ffffffa8114000000000000000000000000000000000000000000000000]
02:10:50,415 | DEBUG | tenerContainer-1 | TransactionContext               |
ache.activemq.TransactionContext  605 | Ended XA transaction:
XID:1197822575:d914000000000000c8996901c0a80114000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000:0100000000000000c8996901c0a80114000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
02:10:50,415 | DEBUG | tenerContainer-1 | TransactionContext               |
ache.activemq.TransactionContext  453 | Commit:
[globalId=ffffffd914000000ffffffc8ffffff99691ffffffc0ffffffa8114000000000000000000000000000000000000000000000000,branchId=10000000ffffffc8ffffff99691ffffffc0ffffffa8114000000000000000000000000000000000000000000000000]
02:10:50,416 | DEBUG | /127.0.0.1:33640 | XATransaction                    |
tivemq.transaction.XATransaction   50 | XA Transaction commit:
XID:1197822575:d914000000000000c8996901c0a80114000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000:0100000000000000c8996901c0a80114000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
02:10:50,421 | DEBUG | ActiveMQ Task    | AMQMessageStore                  |
tivemq.store.amq.AMQMessageStore  370 | Doing batch update... adding: 1
removing: 0 
02:10:50,421 | DEBUG | /127.0.0.1:33640 | AMQMessageStore                  |
vemq.store.amq.AMQMessageStore$2  127 | Transacted message add commit for:
ID:solaris-42062-1252448639837-2:53:1:1:2, at: offset = 86961, file = 1,
size = 451, type = 1
02:10:50,421 | DEBUG | ActiveMQ Task    | KahaReferenceStore               |
re.kahadaptor.KahaReferenceStore  165 | audit add:
ID:solaris-42062-1252448639837-2:53:1:1:1
02:10:50,422 | DEBUG | ActiveMQ Task    | AMQMessageStore                  |
vemq.store.amq.AMQMessageStore$4  385 | adding message
ref:ID:solaris-42062-1252448639837-2:53:1:1:1
02:10:50,422 | DEBUG | ActiveMQ Task    | AMQMessageStore                  |
tivemq.store.amq.AMQMessageStore  418 | Batch update done.
02:10:50,422 | DEBUG | ActiveMQ Task    | AMQMessageStore                  |
tivemq.store.amq.AMQMessageStore  370 | Doing batch update... adding: 1
removing: 0 
02:10:50,422 | DEBUG | queue://newtest5 | Queue                            |
che.activemq.broker.region.Queue 1262 | newtest5 toPageIn: 200, Inflight: 0,
pagedInMessages.size 0
02:10:50,422 | DEBUG | ad:queue://audit | Queue                            |
che.activemq.broker.region.Queue 1262 | audit toPageIn: 200, Inflight: 0,
pagedInMessages.size 0
02:10:50,423 | DEBUG | ActiveMQ Task    | KahaReferenceStore               |
re.kahadaptor.KahaReferenceStore  165 | newtest5 add:
ID:solaris-42062-1252448639837-2:53:1:1:2
02:10:50,423 | DEBUG | tenerContainer-1 | ActiveMQSession                  |
.apache.activemq.ActiveMQSession  524 |
ID:solaris-42062-1252448639837-2:53:1 Transaction Rollback
02:10:50,423 | DEBUG | ActiveMQ Task    | AMQMessageStore                  |
vemq.store.amq.AMQMessageStore$4  385 | adding message
ref:ID:solaris-42062-1252448639837-2:53:1:1:2
02:10:50,424 | DEBUG | tenerContainer-1 | JtaTransactionManager            |
stractPlatformTransactionManager  371 | Creating new transaction with name
[null]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT
02:10:50,424 | DEBUG | ActiveMQ Task    | AMQMessageStore                  |
tivemq.store.amq.AMQMessageStore  418 | Batch update done.
02:10:50,660 | DEBUG | nitor WriteCheck | InactivityMonitor                |
mq.transport.InactivityMonitor$2  102 | 9999 ms elapsed since last write
check.
02:10:50,661 | DEBUG | nitor WriteCheck | InactivityMonitor                |
mq.transport.InactivityMonitor$2  102 | 10001 ms elapsed since last write
check.
02:1

bundle-context.xml
----------------------

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:esb="http://www.tranchida.ch/esb";
        xmlns:jms="http://servicemix.apache.org/jms/1.0";
        xmlns:camel="http://activemq.apache.org/camel/schema/spring";
        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.5.xsd
       http://servicemix.apache.org/jms/1.0
       http://servicemix.apache.org/jms/1.0/servicemix-jms.xsd
       http://activemq.apache.org/camel/schema/spring
      
http://activemq.apache.org/camel/schema/spring/camel-spring-1.6.1.xsd";>

        <!-- use this special class to register the endpoints with the NMR -->
    <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
 
        <jms:consumer id="esb-router-inbound" service="esb:esb-router"
              endpoint="inbound"
              targetService="esb:esb-router"
              targetEndpoint="mediation"
              destinationName="esb"
                          connectionFactory="#pooledConnectionFactory"
                          transacted="xa"
                          cacheLevel="3"/>
        
        <jms:provider id="esb-router-outbound" service="esb:esb-router"
              endpoint="outbound"
              connectionFactory="#pooledConnectionFactory"
              destinationChooser="#dynamicDestinationChooser"/>

        <jms:provider id="esb-router-audit-outbound" service="esb:esb-router"
              endpoint="audit"
              destinationName="audit"
              connectionFactory="#pooledConnectionFactory"/>
        
        <camel:camelContext id="esb-router-context">
                <camel:route id="esb-router-route">
                        <camel:from
uri="jbi:endpoint:http://www.tranchida.ch/esb/esb-router/mediation"; />
                        <camel:multicast>
                                <camel:to
uri="jbi:endpoint:http://www.tranchida.ch/esb/esb-router/audit"; />
                                <camel:to
uri="jbi:endpoint:http://www.tranchida.ch/esb/esb-router/outbound"; />
                        </camel:multicast>
                </camel:route>
        </camel:camelContext>
                        
        <bean id="dynamicDestinationChooser"
class="ch.tranchida.esb.router.DynamicDestinationChooser"/>
        
</beans>

bundle-context-osgi.xml
---------------------------

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:osgi="http://www.springframework.org/schema/osgi";
        xmlns:osgix="http://www.springframework.org/schema/osgi-compendium";
        xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
                      http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi.xsd
                      http://www.springframework.org/schema/osgi-compendium
http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd";>

    <osgi:reference id="pooledConnectionFactory"
interface="javax.jms.ConnectionFactory"
                    cardinality="0..1"/>
                        
</beans>
-- 
View this message in context: 
http://www.nabble.com/ServiceMix-4---Error-calling-transaction-association-listener-tp25356564p25356564.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to