Websphere Liberty 配置文件 - 事务处理的 Websphere MQ 连接工厂 [英] Websphere Liberty profile - transacted Websphere MQ connection factory

查看:23
本文介绍了Websphere Liberty 配置文件 - 事务处理的 Websphere MQ 连接工厂的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图让我的 Liberty 配置文件服务器为我的 Websphere 消息队列实例创建一个事务处理的 jmsConnectionFactory.

Trying to get my Liberty profile server to create a transacted jmsConnectionFactory to my instance of Websphere message queue.

Liberty 配置文件 v 8.5.5.5Websphere MQ 7.x

我尝试将 jmsQueueConnectionFactory 更改为 jmsXAQueueConnectionFactory 但它没有帮助 -> 然后它似乎只是忽略它并且没有连接到 MQ

I've tried to change the jmsQueueConnectionFactory to jmsXAQueueConnectionFactory but it does not help -> Then it seems to just ignore it and doesn't connect to the MQ

server.xml

<?xml version="1.0" encoding="UTF-8"?>
<server description="new server">

  <!-- Enable features -->
  <featureManager>
    <feature>wmqJmsClient-1.1</feature>
    <feature>jndi-1.0</feature>
    <feature>jsp-2.2</feature>
    <feature>localConnector-1.0</feature>
  </featureManager>

  <variable name="wmqJmsClient.rar.location" value="D:\wlp\wmq\wmq.jmsra.rar"/>

  <jmsQueueConnectionFactory jndiName="jms/wmqCF" connectionManagerRef="ConMgr6">
    <properties.wmqJms
            transportType="CLIENT"
            hostName="hostname"
            port="1514"
            channel="SYSTEM.DEF.SVRCONN"
            queueManager="QM"           
            />
  </jmsQueueConnectionFactory>

  <connectionManager id="ConMgr6" maxPoolSize="2"/>

  <applicationMonitor updateTrigger="mbean"/>
  <application id="App"
               location="...\app.war"
               name="App" type="war"/>
  <!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
  <httpEndpoint id="defaultHttpEndpoint"
                httpPort="9080"
                httpsPort="9443"/>
</server>

日志

2015-04-23 17:07:14,981 [JmsConsumer[A0]] WARN  ultJmsMessageListenerContainer - Setup of JMS message listener invoker failed for destination 'A0' - trying to recover. Cause: Could not commit JMS transaction; nested exception is com.ibm.msg.client.jms.DetailedIllegalStateException: JMSCC0014: It is not valid to call the 'commit' method on a nontransacted session. The application called a method that must not be called on a nontransacted session. Change the application program to remove this behavior.
2015-04-23 17:07:14,983 [JmsConsumer[A0]] INFO  ultJmsMessageListenerContainer - Successfully refreshed JMS Connection

骆驼代码

public static JmsComponent mqXAComponentTransacted(InitialContext context, String jndiName) throws JMSException, NamingException {
    return JmsComponent.jmsComponentTransacted((XAQueueConnectionFactory) context.lookup(jndiName));
}

推荐答案

结束于:

public static JmsComponent mqXAComponentTransacted(InitialContext context, String connectionFactoryJndiName, String userTransactionJndiName) throws JMSException, NamingException {
    LOG.info("Setting up JmsComponent using jndi lookup");
    final JtaTransactionManager jtaTransactionManager = new JtaTransactionManager((UserTransaction) context.lookup(userTransactionJndiName));
    final ConnectionFactory connectionFactory = (ConnectionFactory) context.lookup(connectionFactoryJndiName);
    final JmsComponent jmsComponent = JmsComponent.jmsComponentTransacted(connectionFactory, (PlatformTransactionManager) jtaTransactionManager);
    jmsComponent.setTransacted(false);
    jmsComponent.setCacheLevel(DefaultMessageListenerContainer.CACHE_NONE);
    return jmsComponent;
}

这篇关于Websphere Liberty 配置文件 - 事务处理的 Websphere MQ 连接工厂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆