首页 > 解决方案 > 使用 MQ 连接的码头配置时,WebSphere MQ 调用失败,compcode '2' ('MQCC_FAILED') 原因 '2397' ('MQRC_JSSE_ERROR')

问题描述

我在 jetty-env.xml 文件中将 MQ 连接配置为:

<New id="myJmsConnection" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg><Ref refid="wac"/></Arg>
    <Arg>jms/mymq</Arg>
    <Arg>
           <New class="com.ibm.mq.jms.MQConnectionFactory">
                <Set name="connectionNameList">x.x.x.x</Set>
                <Set name="port">xxx</Set>
                <Set name="queueManager">xxx</Set>
                <Set name="channel">xxx.CHANNEL</Set>
                <Set name="transportType">1</Set>
                <Set name="SSLCipherSuite">xxxx</Set>
        </New>
    </Arg>
  </New>

使用上述配置,当我运行码头时,我收到此错误嵌套异常是 com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2397' ('MQRC_JSSE_ERROR' )

但是当我在我的代码中使用相同的配置值来建立 MQ 连接时,我能够建立连接

@Bean(name="MQConnectionFactory")
    public ConnectionFactory connectionFactory() {

        if (factory == null) {
            factory = new MQConnectionFactory();
            try {
                factory.setConnectionNameList(env.getRequiredProperty(HOST));
                factory.setPort(Integer.parseInt(env.getRequiredProperty(PORT)));            
                factory.setQueueManager(env.getRequiredProperty(QUEUE_MANAGER));
                factory.setChannel(env.getRequiredProperty(CHANNEL));
                factory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
                factory.setSSLCipherSuite(env.getRequiredProperty(SSL_CIPHER_SUITE));
                factory.setStringProperty(WMQConstants.USERID, env.getRequiredProperty(QUEUE_USERID));
                factory.setStringProperty(WMQConstants.PASSWORD, env.getRequiredProperty(QUEUE_PASSWORD));

            } catch (JMSException e) {
                throw new RuntimeException(e);
            }
        }
        return factory;
    }

我的问题是为什么连接在 Java 代码中工作,但在 jetty-env.xml 中配置时会引发 MQ 异常?

标签: jettyibm-mq

解决方案


推荐阅读