首先,我想为这里的一些无组织的写作道歉。我正在编写一个spring引导应用程序来从MQ队列中读取消息。但是,在尝试创建MQXAConnectionFactory
对象的实例时遇到异常。而且我意识到它是由于MQXAConnectionFactory extends com.ibm.msg.client.jms.admin.JmsJndiConnectionFactoryImpl
而引起的。实例化MQ ConnectionFactory对象时出现错误
代码片段
@Value("${ems.mq.cf.hostName}")
String mqHostName;
@Value("${ems.mq.cf.port}")
int mqPort;
@Value("${ems.mq.cf.queueManager}")
String mqQueueManager;
@Value("${ems.mq.cf.channel}")
String mqChannel;
private ConnectionFactory mqJmsConnectionFactory() throws JMSException{
try {
MQXAConnectionFactory factory=new MQXAConnectionFactory();
factory.setHostName(mqHostName);
factory.setPort(mqPort);
factory.setQueueManager(mqQueueManager);
factory.setChannel(mqChannel);
factory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
return factory;
}
catch (JMSException e){
throw new RuntimeException(e);
}
}
的问题是,com.ibm.msg.client.jms.admin
包不上任何我有我的类路径上设置的罐子的存在。在IBM网站上建议的解决方案如下所示也无济于事。
The type com.ibm.msg.client.jms.admin.JmsJndiDestinationImpl
cannot be resolved. It is indirectly referenced from required .class files.
本地修订
Import the com.ibm.msg.client.jms.internal from
wmq.jmsra.rar and add it to the build path.
You can find the rar file under <WPS_HOME>\lib\WMQ\ra
但是,这是不是一种选择我,因为我用的是本地的Tomcat服务器,并有我的类路径上的文件不是我的选择。
以下IBM罐子是我的类路径
1. mqjms-7.0.1.0.jar,
2. ibm-mq-7.0.1.0.jar
3. client.osgi.jms.jar
任何有关这帮助将高度赞赏。 Namaste