我正在尝试通过一种非常标准的机制将消息发布到远程 JMS 队列:
TopicConnection tc = null;
TopicSession ts = null;
TopicPublisher tp = null;
Properties p = new Properties();
String providerUrl = "iiop://servername:9810";
String contextFactory = "com.ibm.websphere.naming.WsnInitialContextFactory".trim();
p.put(javax.naming.Context.PROVIDER_URL, providerUrl );
p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, contextFactory );
InitialContext ct = new InitialContext(p);
{
Topic topic = (Topic)ct.lookup( "jms/customer_event" );
TopicConnectionFactory tcf = (TopicConnectionFactory)ct.lookup( "jms/TopicFactory2" );
tc = tcf.createTopicConnection();
....
..
..
}
现在, Topic 和 TopicConnectionFactory 查找很好,但是当涉及到 时tcf.createTopicConnection()
,它会抛出:
javax.jms.JMSException: MQJMS2005: failed to create MQQueueManager for 'servername:QMGR1'
Inner exception(s):
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2059
java.net.ConnectException: Connection refused: connect
我打开了 MQ 资源管理器,主题在远程队列管理器上。TopicCoonectionFactory 是否TopicFactory2
也应该驻留在队列管理器上?因为它没有。错误的原因可能是什么?