Problem with NamedXAResource.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with NamedXAResource.

sahlex
Hi there.

Following the description on http://cxf.apache.org/docs/jms-transactions.html, I set up a JMS XA transaction together with pax-jdbc datasource in karaf 4.1.2.

The datasource looks like this:

osgi.jdbc.driver.name = mariadb
dataSourceName = jmsTest
databaseName = test
user = test
password = test
pool = aries
xa = true
url = jdbc:mariadb://172.17.42.50:3309/test?characterEncoding=UTF-8

the jms config is like this (blueprint.xml):

    <reference id="txMgr"
               interface="javax.transaction.TransactionManager" />

    <bean id="xaConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
        <property name="brokerURL" value="${activemq.url}" />
        <property name="watchTopicAdvisories" value="false" />
    </bean>

    <bean id="jcaConnectionFactory" class="org.apache.activemq.jms.pool.JcaPooledConnectionFactory"
        init-method="start" destroy-method="stop">
        <property name="transactionManager" ref="txMgr"/>
        <property name="maxConnections" value="10" />
        <property name="connectionFactory" ref="xaConnectionFactory"/>
    </bean>

    <bean id="jmsTxConf" class="org.apache.activemq.camel.component.ActiveMQConfiguration">
        <property name="connectionFactory" ref="jcaConnectionFactory" />
        <property name="requestTimeout" value="10000" />
        <property name="transactionTimeout" value="30" />
        <property name="transacted" value="true" />
        <property name="cacheLevelName" value="CACHE_NONE" />
    </bean>

    <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" >
        <property name="configuration" ref="jmsTxConf" />
    </bean>

However, I still get an exception when committing the transaction:

2017-12-15T15:31:02,989 | ERROR | DefaultQuartzScheduler-com.brodos.example.jmstest.jmsTest-service-quartzCamelPublisher_Worker-4 | Transaction                      | 216 - org.apache.aries.transaction.manager - 1.3.3 | Please correct the integration and supply a NamedXAResource
java.lang.IllegalStateException: Cannot log transactions as TransactionContext{transactionId=null,connection=ActiveMQConnection {id=ID:dbserver-p2-46845-1513344298542-9:2,clientId=ID:dbserver-p2-46845-1513344298542-8:1,started=false}} is not a NamedXAResource.
        at org.apache.geronimo.transaction.manager.TransactionImpl$TransactionBranch.getResourceName(TransactionImpl.java:781) [216:org.apache.aries.transaction.manager:1.3.3]
        at org.apache.geronimo.transaction.log.HOWLLog.prepare(HOWLLog.java:287) [216:org.apache.aries.transaction.manager:1.3.3]
        at org.apache.geronimo.transaction.manager.TransactionImpl.internalPrepare(TransactionImpl.java:467) [216:org.apache.aries.transaction.manager:1.3.3]
        at org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:312) [216:org.apache.aries.transaction.manager:1.3.3]
        at org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:252) [216:org.apache.aries.transaction.manager:1.3.3]
        at Proxy288c74b2_e728_4a18_9e5f_69dd12784603.commit(Unknown Source) [?:?]
        at org.apache.aries.transaction.TransactionAttribute$5.finish(TransactionAttribute.java:138) [215:org.apache.aries.transaction.blueprint:2.1.0]
        at org.apache.aries.transaction.TxInterceptorImpl.postCallWithReturn(TxInterceptorImpl.java:105) [215:org.apache.aries.transaction.blueprint:2.1.0]
        at org.apache.aries.blueprint.proxy.SingleInterceptorCollaborator.postInvoke(SingleInterceptorCollaborator.java:76) [11:org.apache.aries.blueprint.core:1.8.2]
        at Proxy1e31f2f9_b5f0_4b21_b4f7_80d8cf3712a1.publishNotifications(Unknown Source) [?:?]
        at com.brodos.jmsconurrent.service.notification.NotificationBatchProcessor.publishNotifications(NotificationBatchProcessor.java:46) [194:com.brodos.example.jmstest.jmsTest-service:1.0.0.SNAPSHOT]
        at sun.reflect.GeneratedMethodAccessor250.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:497) ~[?:?]
        at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:472) [21:org.apache.camel.camel-core:2.19.2]
        at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:291) [21:org.apache.camel.camel-core:2.19.2]
        at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:264) [21:org.apache.camel.camel-core:2.19.2]
        at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:178) [21:org.apache.camel.camel-core:2.19.2]
        at org.apache.camel.component.bean.BeanProducer.process(BeanProducer.java:41) [21:org.apache.camel.camel-core:2.19.2]
        at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145) [21:org.apache.camel.camel-core:2.19.2]
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) [21:org.apache.camel.camel-core:2.19.2]
...

I'm using JPA/2.6.1 feature and hibernate 5.2.10.Final as persistence provider.

Could anyone please give a hint what's wrong here?

Best,
Alexander
Reply | Threaded
Open this post in threaded view
|

Re: Problem with NamedXAResource.

Benjamin Graf

Hi Alexander,

you didn't name your JMS XA resource. Set a name property at JcaPooledConnectionFactory e.g. amq. That should solve this Exception

Regards,

Benjamin


Am 15.12.2017 um 16:41 schrieb [hidden email]:
Hi there.

Following the description on http://cxf.apache.org/docs/jms-transactions.html, I set up a JMS XA transaction together with pax-jdbc datasource in karaf 4.1.2.

The datasource looks like this:

osgi.jdbc.driver.name = mariadb
dataSourceName = jmsTest
databaseName = test
user = test
password = test
pool = aries
xa = true
url = jdbc:mariadb://172.17.42.50:3309/test?characterEncoding=UTF-8

the jms config is like this (blueprint.xml):

    <reference id="txMgr"
               interface="javax.transaction.TransactionManager" />

    <bean id="xaConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
        <property name="brokerURL" value="${activemq.url}" />
        <property name="watchTopicAdvisories" value="false" />
    </bean>

    <bean id="jcaConnectionFactory" class="org.apache.activemq.jms.pool.JcaPooledConnectionFactory"
        init-method="start" destroy-method="stop">
        <property name="transactionManager" ref="txMgr"/>
        <property name="maxConnections" value="10" />
        <property name="connectionFactory" ref="xaConnectionFactory"/>
    </bean>

    <bean id="jmsTxConf" class="org.apache.activemq.camel.component.ActiveMQConfiguration">
        <property name="connectionFactory" ref="jcaConnectionFactory" />
        <property name="requestTimeout" value="10000" />
        <property name="transactionTimeout" value="30" />
        <property name="transacted" value="true" />
        <property name="cacheLevelName" value="CACHE_NONE" />
    </bean>

    <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" >
        <property name="configuration" ref="jmsTxConf" />
    </bean>

However, I still get an exception when committing the transaction:

2017-12-15T15:31:02,989 | ERROR | DefaultQuartzScheduler-com.brodos.example.jmstest.jmsTest-service-quartzCamelPublisher_Worker-4 | Transaction                      | 216 - org.apache.aries.transaction.manager - 1.3.3 | Please correct the integration and supply a NamedXAResource
java.lang.IllegalStateException: Cannot log transactions as TransactionContext{transactionId=null,connection=ActiveMQConnection {id=ID:dbserver-p2-46845-1513344298542-9:2,clientId=ID:dbserver-p2-46845-1513344298542-8:1,started=false}} is not a NamedXAResource.
        at org.apache.geronimo.transaction.manager.TransactionImpl$TransactionBranch.getResourceName(TransactionImpl.java:781) [216:org.apache.aries.transaction.manager:1.3.3]
        at org.apache.geronimo.transaction.log.HOWLLog.prepare(HOWLLog.java:287) [216:org.apache.aries.transaction.manager:1.3.3]
        at org.apache.geronimo.transaction.manager.TransactionImpl.internalPrepare(TransactionImpl.java:467) [216:org.apache.aries.transaction.manager:1.3.3]
        at org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:312) [216:org.apache.aries.transaction.manager:1.3.3]
        at org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:252) [216:org.apache.aries.transaction.manager:1.3.3]
        at Proxy288c74b2_e728_4a18_9e5f_69dd12784603.commit(Unknown Source) [?:?]
        at org.apache.aries.transaction.TransactionAttribute$5.finish(TransactionAttribute.java:138) [215:org.apache.aries.transaction.blueprint:2.1.0]
        at org.apache.aries.transaction.TxInterceptorImpl.postCallWithReturn(TxInterceptorImpl.java:105) [215:org.apache.aries.transaction.blueprint:2.1.0]
        at org.apache.aries.blueprint.proxy.SingleInterceptorCollaborator.postInvoke(SingleInterceptorCollaborator.java:76) [11:org.apache.aries.blueprint.core:1.8.2]
        at Proxy1e31f2f9_b5f0_4b21_b4f7_80d8cf3712a1.publishNotifications(Unknown Source) [?:?]
        at com.brodos.jmsconurrent.service.notification.NotificationBatchProcessor.publishNotifications(NotificationBatchProcessor.java:46) [194:com.brodos.example.jmstest.jmsTest-service:1.0.0.SNAPSHOT]
        at sun.reflect.GeneratedMethodAccessor250.invoke(Unknown Source) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:497) ~[?:?]
        at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:472) [21:org.apache.camel.camel-core:2.19.2]
        at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:291) [21:org.apache.camel.camel-core:2.19.2]
        at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:264) [21:org.apache.camel.camel-core:2.19.2]
        at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:178) [21:org.apache.camel.camel-core:2.19.2]
        at org.apache.camel.component.bean.BeanProducer.process(BeanProducer.java:41) [21:org.apache.camel.camel-core:2.19.2]
        at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145) [21:org.apache.camel.camel-core:2.19.2]
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) [21:org.apache.camel.camel-core:2.19.2]
...

I'm using JPA/2.6.1 feature and hibernate 5.2.10.Final as persistence provider.

Could anyone please give a hint what's wrong here?

Best,
Alexander


signature.asc (499 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Antw: Re: Problem with NamedXAResource.

sahlex
Hi Benjamin!

Thank you very much! That's indeed solved the issue.

Best, Alexander


>>>
>
Hi Alexander,
you didn't name your JMS XA resource. Set a name property at JcaPooledConnectionFactory e.g. amq. That should solve this Exception
Regards,
Benjamin

Am 15.12.2017 um 16:41 schrieb [hidden email]:
Hi there.

Following the description on http://cxf.apache.org/docs/jms-transactions.html, I set up a JMS XA transaction together with pax-jdbc datasource in karaf 4.1.2.

The datasource looks like this:

osgi.jdbc.driver.name = mariadb
dataSourceName = jmsTest
databaseName = test
user = test
password = test
pool = aries
xa = true
url = jdbc:mariadb://172.17.42.50:3309/test?characterEncoding=UTF-8

the jms config is like this (blueprint.xml):

<reference id="txMgr"
interface="javax.transaction.TransactionManager" />

<bean id="xaConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
<property name="brokerURL" value="${activemq.url}" />
<property name="watchTopicAdvisories" value="false" />
</bean>

<bean id="jcaConnectionFactory" class="org.apache.activemq.jms.pool.JcaPooledConnectionFactory"
init-method="start" destroy-method="stop">
<property name="transactionManager" ref="txMgr"/>
<property name="maxConnections" value="10" />
<property name="connectionFactory" ref="xaConnectionFactory"/>
</bean>

<bean id="jmsTxConf" class="org.apache.activemq.camel.component.ActiveMQConfiguration">
<property name="connectionFactory" ref="jcaConnectionFactory" />
<property name="requestTimeout" value="10000" />
<property name="transactionTimeout" value="30" />
<property name="transacted" value="true" />
<property name="cacheLevelName" value="CACHE_NONE" />
</bean>

<bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent" >
<property name="configuration" ref="jmsTxConf" />
</bean>

However, I still get an exception when committing the transaction:

2017-12-15T15:31:02,989 | ERROR | DefaultQuartzScheduler-com.brodos.example.jmstest.jmsTest-service-quartzCamelPublisher_Worker-4 | Transaction | 216 - org.apache.aries.transaction.manager - 1.3.3 | Please correct the integration and supply a NamedXAResource
java.lang.IllegalStateException: Cannot log transactions as TransactionContext{transactionId=null,connection=ActiveMQConnection {id=ID:dbserver-p2-46845-1513344298542-9:2,clientId=ID:dbserver-p2-46845-1513344298542-8:1,started=false}} is not a NamedXAResource.
at org.apache.geronimo.transaction.manager.TransactionImpl$TransactionBranch.getResourceName(TransactionImpl.java:781) [216:org.apache.aries.transaction.manager:1.3.3]
at org.apache.geronimo.transaction.log.HOWLLog.prepare(HOWLLog.java:287) [216:org.apache.aries.transaction.manager:1.3.3]
at org.apache.geronimo.transaction.manager.TransactionImpl.internalPrepare(TransactionImpl.java:467) [216:org.apache.aries.transaction.manager:1.3.3]
at org.apache.geronimo.transaction.manager.TransactionImpl.commit(TransactionImpl.java:312) [216:org.apache.aries.transaction.manager:1.3.3]
at org.apache.geronimo.transaction.manager.TransactionManagerImpl.commit(TransactionManagerImpl.java:252) [216:org.apache.aries.transaction.manager:1.3.3]
at Proxy288c74b2_e728_4a18_9e5f_69dd12784603.commit(Unknown Source) [?:?]
at org.apache.aries.transaction.TransactionAttribute$5.finish(TransactionAttribute.java:138) [215:org.apache.aries.transaction.blueprint:2.1.0]
at org.apache.aries.transaction.TxInterceptorImpl.postCallWithReturn(TxInterceptorImpl.java:105) [215:org.apache.aries.transaction.blueprint:2.1.0]
at org.apache.aries.blueprint.proxy.SingleInterceptorCollaborator.postInvoke(SingleInterceptorCollaborator.java:76) [11:org.apache.aries.blueprint.core:1.8.2]
at Proxy1e31f2f9_b5f0_4b21_b4f7_80d8cf3712a1.publishNotifications(Unknown Source) [?:?]
at com.brodos.jmsconurrent.service.notification.NotificationBatchProcessor.publishNotifications(NotificationBatchProcessor.java:46) [194:com.brodos.example.jmstest.jmsTest-service:1.0.0.SNAPSHOT]
at sun.reflect.GeneratedMethodAccessor250.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:497) ~[?:?]
at org.apache.camel.component.bean.MethodInfo.invoke(MethodInfo.java:472) [21:org.apache.camel.camel-core:2.19.2]
at org.apache.camel.component.bean.MethodInfo$1.doProceed(MethodInfo.java:291) [21:org.apache.camel.camel-core:2.19.2]
at org.apache.camel.component.bean.MethodInfo$1.proceed(MethodInfo.java:264) [21:org.apache.camel.camel-core:2.19.2]
at org.apache.camel.component.bean.BeanProcessor.process(BeanProcessor.java:178) [21:org.apache.camel.camel-core:2.19.2]
at org.apache.camel.component.bean.BeanProducer.process(BeanProducer.java:41) [21:org.apache.camel.camel-core:2.19.2]
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145) [21:org.apache.camel.camel-core:2.19.2]
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77) [21:org.apache.camel.camel-core:2.19.2]
...

I'm using JPA/2.6.1 feature and hibernate 5.2.10.Final as persistence provider.

Could anyone please give a hint what's wrong here?

Best,
Alexander