jboss 7中的事务管理器bean

时间:2018-02-20 04:48:21

标签: spring jboss7.x ibm-mq

我们正在使用IBM MQ作为消息传递提供程序在jboss 7中部署MDB。我们正在从IBM WAS应用服务器迁移(MDB EAR)到Jboss,在IBM MQ中保留消息传递。 作为迁移的一部分,我们需要将事务管理器从IBM Web sphere App服务器更改为JBoss特定的事务管理器。

如下所示,wsTxManager bean特定于web sphere。我们需要Jboss特定的bean。你能帮我解决这个问题吗?

<bean id="wsTxManager"
        class="org.springframework.transaction.jta.WebSphereTransactionManagerFactoryBean" />

    <bean id="txManager"
        class="org.springframework.transaction.jta.JtaTransactionManager">
        <property name="userTransactionName">
            <null />
        </property>
        <property name="transactionManager" ref="wsTxManager" />
    </bean> 

日志:

7c11372: display name [org.springframework.context.support.ClassPathXmlApplicationContext@77c11372]; startup date [Tue Feb 20 17:21:42 SGT 2018]; root of context hierarchy
[2018-02-20 17:21:42,674] [default-threads - 12] [INFO ] [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from URL [vfs:/content/our_app.ear/our_app.jar/beanRefContext.xml]
[2018-02-20 17:21:42,976] [default-threads - 12] [INFO ] [org.springframework.context.support.ClassPathXmlApplicationContext] - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@77c11372]: org.springframework.beans.factory.support.DefaultListableBeanFactory@406aa4b4
[2018-02-20 17:21:42,981] [default-threads - 12] [INFO ] [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@406aa4b4: defining beans [businessBeanFactory]; root of factory hierarchy
[2018-02-20 17:21:43,000] [default-threads - 12] [INFO ] [org.springframework.context.support.ClassPathXmlApplicationContext] - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@66b1b69e: display name [org.springframework.context.support.ClassPathXmlApplicationContext@66b1b69e]; startup date [Tue Feb 20 17:21:43 SGT 2018]; root of context hierarchy
[2018-02-20 17:21:43,000] [default-threads - 12] [INFO ] [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from class path resource [app-ejb-context.xml]
[2018-02-20 17:21:43,034] [default-threads - 12] [INFO ] [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@406aa4b4: defining beans [businessBeanFactory]; root of factory hierarchy
[2018-02-20 17:21:43,045] [default-threads - 29] [INFO ] [org.springframework.context.support.ClassPathXmlApplicationContext] - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@7e92809d: display name [org.springframework.context.support.ClassPathXmlApplicationContext@7e92809d]; startup date [Tue Feb 20 17:21:43 SGT 2018]; root of context hierarchy

1 个答案:

答案 0 :(得分:0)

它应该适用于JBoss:

<bean id="containerTransaction" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName">
        <value>java:/TransactionManager</value>
    </property>
</bean>
<bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
    <property name="transactionManager">
        <ref local="containerTransaction"/>
    </property>
    <property name="userTransactionName">
        <value>java:jboss/UserTransaction</value>
    </property>
</bean>