2014-10-29 74 views
0

我們試圖使用在JBoss EAP上運行的Active MQ 5.10.0,camel 2.13.1來創建XA連接池6.2。當連接釋放到池時,會引發下面的Exception。根據其他線程,此錯誤已通過Active MQ 5.8.x解決。任何想法爲什麼我們仍然得到錯誤?活動MQ客戶端和服務器在5.10.0中運行。javax.jms.TransactionInProgressException:無法在JBoss EAP 6.2和Active MQ上的XASession內部rollback()5.10.0

彈簧配置:

<!-- JBoss TX Manager --> 
 
    <bean id="jtaTxManager" 
 
     class="org.springframework.transaction.jta.JtaTransactionManager"> 
 
     <property name="transactionManagerName" value="java:/TransactionManager" /> 
 
    </bean> 
 
    
 
    <bean id="jmsXaConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory"> 
 
     <property name="brokerURL" value="$camelProp{brokerUrl}" /> 
 
     <property name="userName" value="$camelProp{queueUsername}" /> 
 
     <property name="password" value="$camelProp{queuePw}" /> 
 
    </bean> 
 
    
 
    <bean id="pooledXAConnectionFactory" class="org.apache.activemq.pool.XaPooledConnectionFactory" 
 
     init-method="start" destroy-method="stop"> 
 
     <property name="maxConnections" value="$camelProp{queue.maxConnections}" /> 
 
     <property name="connectionFactory" ref="jmsXaConnectionFactory" /> 
 
    </bean> 
 

 
    <bean id="jmsConfig" class="org.apache.camel.component.jms.JmsConfiguration"> 
 
     <property name="connectionFactory" ref="pooledXAConnectionFactory" /> 
 
     <property name="concurrentConsumers" value="$camelProp{queue.concurrentConsumers}" /> 
 
     <!-- define the jms consumer/producer as transacted --> 
 
     <property name="transacted" value="true" /> 
 
     <!-- setup the transaction manager to use --> 
 
     <property name="transactionManager" ref="jtaTxManager" /> 
 
    </bean> 
 

 
    <!-- define our activemq component --> 
 
    <bean id="activemq" 
 
     class="org.apache.activemq.camel.component.ActiveMQComponent"> 
 
     <property name="configuration" ref="jmsConfig" /> 
 
    </bean>

例外:

12:45:06277 WARN [org.apache.activemq.jms.pool.PooledSession](HTTP-本地主機/ 127.0.0.1:8180-1)在將會話放回池中時嘗試rollback()會引發異常,將導致無效。 javax.jms.TransactionInProgressException:無法在XASession中執行rollback():javax.jms.TransactionInProgressException:無法在XASession中回滾() at org.apache.activemq.ActiveMQXASession.rollback(ActiveMQXASession.java:78)[activemq-client- 5.10.0.jar:5.10.0] at org.apache.activemq.jms.pool.PooledSession.close(PooledSession.java:116)[activemq-jms-pool-5.10.0.jar:5.10.0] at org.springframework.jms.connection.JmsResourceHolder.closeAll(JmsResourceHolder.java:215)[spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.jms.connection.ConnectionFactoryUtils $ JmsResourceSynchronization.releaseResource(ConnectionFactoryUtils.java:412)[spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.jms.connection.ConnectionFactoryUtils $ JmsResourceSynchronization.releaseResource(ConnectionFactoryUtils。 java:389)[spring-jms-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.transaction.support.ResourceHolderSynchronization.afterCompletion(ResourceHolderSynchronization.java:98)[spring-tx-3.2。 8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.transaction.support.TransactionSynchronizationUtils.invokeAfterCompletion(TransactionSynchronizationUtils.java:168)[spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE ] 在org.springframework.transaction.support.AbstractPlatformTransactionManager.invokeAfterCompletion(AbstractPlatformTransactionManager.java:994)[彈簧-TX-3.2.8.RELEASE.jar:3.2.8.RELEASE] 在org.springframework.transaction.support。 AbstractPlatformTransactionManager.triggerAfterCompletion(AbstractPlatformTransactionManager.java:969)[spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.transaction.support.Abs tractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:800)[spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)[ spring-tx-3.2.8.RELEASE.jar:3.2.8.RELEASE] at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:148)[spring-tx-3.2.8.RELEASE.jar :3.2.8.RELEASE] at org.apache.camel.spring.spi.TransactionErrorHandler.doInTransactionTemplate(TransactionErrorHandler.java:174)[camel-spring-2.13.1.jar:2.13.1] at org.apache。 camel.spring.spi.TransactionErrorHandler.processInTransaction(TransactionErrorHandler.java:134)[camel-spring-2.13.1.jar:2.13.1] at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java : 103)[camel-spring-2.13.1.jar:2.13.1] at org.apache.camel.spring.spi.TransactionErrorHandler.process(TransactionErrorHandler.java:112)[camel-spring-2.13.1.jar: 2.13.1] at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)[camel-core-2.13.1.jar:2.13.1] at org.apache.camel.processor.CamelInternalProcessor .process(CamelInternalProcessor.java:191)[camel-core-2.13.1.jar:2.13.1] at org.apache.camel.util.AsyncProcessorHelper。進程(AsyncProcessorHelper.java:105)[camel-core-2.13.1.jar:2.13.1] at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:87)[camel-core-2.13。 1.jar:2.13.1] at org.apache.camel.component.cxf.CxfConsumer $ 1.syncInvoke(CxfConsumer.java:136)[camel-cxf-2.13.1.jar:2.13.1] at org。 apache.camel.component.cxf.CxfConsumer $ 1.invoke(CxfConsumer.java:77)[camel-cxf-2.13.1.jar:2.13.1] at org.apache.cxf.interceptor.ServiceInvokerInterceptor $ 1.run(ServiceInvokerInterceptor .java:58)[cxf-api-2.7.10.jar:2.7.10] at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:471)[rt.jar:1.7.0_65] 在java.util.concurrent.FutureTask.run(FutureTask.java:262)[rt.jar:1.7.0_65] at org.apache.cxf.workqueue.SynchronousExecutor.execute(Synchr onousExecutor.java:37)[cxf-api-2.7.10.jar:2.7.10] at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:107)[cxf-api-2.7.10。 jar:2.7.10] at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)[cxf-api-2.7.10.jar:2.7.10] at org.apache.cxf.transport .ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)[cxf-api-2.7.10.jar:2.7.10] at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:239)[cxf -rt-transports-http-2.7.10.jar:2.7.10] at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)[cxf-rt-transports-http-2.7。 10.jar:2.7.10] at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)[c xf-rt-transports-http-2.7.10.jar:2.7.10] at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)[cxf-rt-transports-http-2.7 .10.jar:2.7.10] at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:167)[cxf-rt-transports-http-2.7.10.jar:2.7.10] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286)[cxf-rt-transports-http-2.7.10.jar:2.7.10] at org.apache.cxf.transport .servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:206)[cxf-rt-transports-http-2.7.10.jar:2.7.10] at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.2.Final-redhat-1.jar:1.0.2.Final-redhat-1] at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTT PServlet.java:262)[cxf-rt-transports-http-2.7.10.jar:2.7.10] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295)[jbossweb-7.2。 2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214)[jbossweb-7.2.2.Final-redhat -1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)[jbossweb-7.2.2.Final-redhat-1.jar: 7.2.2.Final-redhat-1] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149)[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final -redhat-1] at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169)[jboss-as-web-7.3.0.Final-redhat-14.jar:7.3.0。 Final-redhat-14] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145)[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache .catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97)[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.core。 StandardEngineValve.invoke(StandardEngineValve.java:102)[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter .java:336)[jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.coyote.http11.Http11Protocol $ Http11ConnectionHandler.process(Http11Protocol.java:653)[jbossweb- 7.2.2。Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.tomcat.util.net.JIoEndpoint $ Worker.run(JIoEndpoint.java:920)[jbossweb-7.2.2.Final -redhat-1.jar:7.2.2.Final-redhat-1] at java.lang.Thread.run(Thread.java:745)[rt.jar:1.7.0_65]

回答

1

有一些奇怪的事情要去在該交易中。我知道的一件事是你的配置不太正確。

的JmsConfig豆需要有transacted="false" - 屬性名是有點誤導,因爲它實際上是指「在本地管理該交易」(這只是設置在底層的彈簧使用DefaultMessageListenerContainer的transactedSession財產,是指this

你也需要在PooledConnectionFactory上設置transactionManager(我非常肯定你是否在ActiveMQClient上的transactionManager爲空時在此上運行調試器)。

這裏有一個工作的例子,我已經得到了在時刻(EAP 6.2和5.9 AMQ)上運行

<bean id="jmsXaConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory"> 
    <property name="brokerURL" value="${amq.broker.url}?jms.prefetchPolicy.all=1"/> 
    <property name="userName" value="${amq.broker.connection.user}" /> 
     <property name="password" value="${amq.broker.connection.password}" /> 
    <property name="redeliveryPolicy"> 
    <bean class="org.apache.activemq.RedeliveryPolicy"> 
     <property name="maximumRedeliveries" value="0"/> 
    </bean> 
    </property> 
</bean> 

<bean id="jmsPoolConnectionFactory" class="org.apache.activemq.pool.XaPooledConnectionFactory"> 
     <property name="maxConnections" value="12" /> 
    <property name="connectionFactory" ref="jmsXaConnectionFactory" /> 
    <property name="transactionManager" ref="jtaTransactionManager" /> 
</bean> 


<bean id="jtaTransactionManager" class="org.springframework.jndi.JndiObjectFactoryBean"> 
    <property name="jndiName" value="java:/TransactionManager" /> 
    <property name="lookupOnStartup" value="false" /> 
    <property name="cache" value="true" /> 
    <property name="proxyInterface" value="javax.transaction.TransactionManager" /> 
</bean> 

<bean id="userTransaction" class="org.springframework.jndi.JndiObjectFactoryBean"> 
    <property name="jndiName" value="java:jboss/UserTransaction" /> 
    <property name="lookupOnStartup" value="false" /> 
    <property name="cache" value="true" /> 
    <property name="proxyInterface" value="javax.transaction.UserTransaction" /> 
</bean> 

<bean name="transactionManager" 
    class="org.springframework.transaction.jta.JtaTransactionManager"> 
    <property name="transactionManager" ref="jtaTransactionManager" /> 
    <property name="userTransaction" ref="userTransaction" /> 
</bean> 

<bean id="jms" class="org.apache.camel.component.jms.JmsComponent"> 
    <property name="configuration" ref="jmsTxConfig" /> 
</bean> 

<bean id="jmsTxConfig" 
     class="org.apache.camel.component.jms.JmsConfiguration"> 
    <property name="connectionFactory" ref="jmsPoolConnectionFactory"/> 
    <property name="transactionManager" ref="transactionManager"/> 
    <property name="transacted" value="false"/> 
    <property name="cacheLevelName" value="CACHE_CONNECTION"/> 
</bean> 
相關問題