我在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>
通过上面的配置,当我运行jetty时,我收到了这个错误 嵌套异常是com.ibm.mq.MQException:JMSCMQ0001:WebSphere MQ调用失败,包含compcode&#39; 2&#39; (&#39; MQCC_FAILED&#39;)原因&#39; 2397&#39; (&#39; MQRC_JSSE_ERROR&#39)
但是当我在我的代码中使用相同的配置值来建立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异常?