Tomcat、Websphere MQ和Atomikos:无法集成事务管理器

Tomcat、Websphere MQ和Atomikos:无法集成事务管理器,tomcat,ibm-mq,mq,atomikos,Tomcat,Ibm Mq,Mq,Atomikos,采取的步骤: 遵循链接中提到的所有步骤 A.将“atomikos-integration-extension-3.7.1-20120529.jar”复制到TOMCAT_HOME/lib文件夹中 b。server.xml c。context.xml d。添加了所有必需的事务jar。此外,交易属性: 代码中所做的更改 a。transaction.xml: <bean id="UserTransactionBean" class="org.springframework

采取的步骤:

  • 遵循链接中提到的所有步骤 A.将“atomikos-integration-extension-3.7.1-20120529.jar”复制到TOMCAT_HOME/lib文件夹中

    b。server.xml

    c。context.xml

    d。添加了所有必需的事务jar。此外,交易属性:

  • 代码中所做的更改

  • a。transaction.xml:

    <bean id="UserTransactionBean"
        class="org.springframework.jndi.JndiObjectFactoryBean">
        <property name="jndiName" value="java:comp/UserTransaction"></property>
    </bean>
    
    <!--  One Bean that applies Transaction semantics as well as Retry Logic. It only supports
    PROPOGATION_REQUIRED SEMANTICS.
    -->
    <bean id="TstTransactionInterceptor"
        class="com.test.transaction.interceptor.TstTransactionInterceptor">
    
        <property name="exceptionHandler" ref="TstRuntimeExceptionHandler" />
    
        <!--  Max Times to Retry a Transaction eligible for Retry -->
        <property name="maxRetryAttempts" value="1" />
    
        <!--  Time to wait between retries of eligible transactions ( in seconds)
        -->
        <property name="waitTimeBetweenRetries" value="2"></property>
        <property name="userTransaction" ref="UserTransactionBean" />
    
        <!--  List of methods that transaction interceptor will not apply declarative transactions for
        -->
        <property name="excludedMethodList">
            <list>
                <value>toString</value>
                <value>equals</value>
            </list>
        </property>
    </bean>
    
    <bean id="JTATxManager"
        class="org.springframework.transaction.jta.JtaTransactionManager">
        <property name="autodetectTransactionManager" value="true" />
    </bean>
    
    <bean id="SpringTransactionInterceptor"
        class="org.springframework.transaction.interceptor.TransactionInterceptor">
        <property name="transactionManager">
            <ref bean="JTATxManager" />
        </property>
        <property name="transactionAttributeSource">
            <ref bean="TransactionAttributes" />
        </property>
    </bean>
    

    如果有人遇到过这个问题,请告诉我们您是如何解决的。

    过去曾经这样做过,而且确实有效。我记得不同的Tomcat/WMQ/Atomikos版本在JNDI设置中可能有一些小的差异。您是通过数据库获得JTA事务,还是仅仅让数据库连接工作?我将研究atomikos日志,以验证DB是否与atomikos合作。另一个指针是使用Springbean直接连接WebSphere MQ XAConnectionFactory—注入事务管理器,当事务管理器正常工作时—返回WMQ的JNDI配置。另外,请验证启动日志-调试模式以获取更多指针。WMQ客户端的哪个版本?直到v7.0及更高版本的最新版本,免费客户端安装程序中才提供XA客户端。但即便如此,仍然需要再次下载客户机以获得XA功能。如果WMQ客户端安装正确,YOU可以执行
    dspmqver
    来确定哪个版本。
    -- checkUserTransactionAndTransactionManager, No JTA TransactionManager found: transaction suspension not available
    
    -- WARNING: atomikos connection pool 'QCF_MQSeries_XA_RMI': error creating proxy of connection atomikos pooled connection for resource QCF_MQSeries_XA_RMI
        [3/28/14 14:26:25:052 CDT] 00000137 ConnectionPoo W com.atomikos.logging.JULLogger logWarning atomikos connection pool 'QCF_MQSeries_XA_RMI': error creating proxy of connection atomikos pooled connection for resource QCF_MQSeries_XA_RMI
                                 com.atomikos.datasource.pool.CreateConnectionException: atomikos pooled connection for resource QCF_MQSeries_XA_RMI: connection is erroneous
    
    --  WARN   logWarning, atomikos MessageConsumer proxy for com.ibm.mq.jms.MQQueueReceiver@73085060: The JMS session you are using requires a JTA transaction context for the calling thread and none was found.
        WARN   logWarning, Error in proxy
        com.atomikos.jms.AtomikosTransactionRequiredJMSException: The JMS session you are using requires a JTA transaction context for the calling thread and none was found.
        Please correct your code to do one of the following: 
        1. start a JTA transaction if you want your JMS operations to be subject to JTA commit/rollback, or
        2. increase the maxPoolSize of the AtomikosConnectionFactoryBean to avoid transaction timeout while waiting for a connection, or
        3. create a non-transacted session and do session acknowledgment yourself, or
        4. set localTransactionMode to true so connection-level commit/rollback are enabled.
            at com.atomikos.jms.AtomikosTransactionRequiredJMSException.throwAtomikosTransactionRequiredJMSException(AtomikosTransactionRequiredJMSException.java:40)