问题描述
在我的GetJMSMessage中,我使用了这个:
In my GetJMSMessage, I used this:
MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
cf.setPort(port);
cf.setHostName(host);
cf.setChannel(channel);
cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
cf.setQueueManager(queuemanager);
conn = (MQQueueConnection)cf.createQueueConnection();
当我将我的课程作为独立应用程序运行时,这种方法有效。但是,当我在Weblogic 10中部署我的项目时,它给出了JMSException错误。 IBM MQ是远程部署的,我无法访问它。
This works when I run my class as a standalone app. However, when I deployed my project in Weblogic 10, it gave a JMSException error. IBM MQ is deployed remotely and I have no access to it.
错误堆栈跟踪是javax.jms.JMSException:
The error stacktrace is javax.jms.JMSException:
MQJMS2005: failed to create MQQueueManager for 'hostname:queuemanager'
at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:644)
at com.ibm.mq.jms.MQConnection.createQM(MQConnection.java:2567)
at com.ibm.mq.jms.MQConnection.createQMNonXA(MQConnection.java:1912)
at com.ibm.mq.jms.MQQueueConnection.<init>(MQQueueConnection.java:161)
at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:202)
at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:121)
at com.ibm.mq.jms.MQQueueConnectionFactory.createConnection(MQQueueConnectionFactory.java:1038)
导致此错误的原因是什么?如何解决此问题?为什么只有在我的本地服务器中部署项目时才会出现此错误?
What causes this error and how can I fix this? and why does this error arises only when I deployed the project in my local server?
推荐答案
使用JMS时会出现异常但是不知道原因,您可能经常在一个或多个链接的异常中找到更多信息,您可以通过以下内容查看:
When using JMS and you get an exception but don't know the cause, you might often find more information in one or more linked exceptions, which you can see with something like the following:
System.out.println(jmsex);
Throwable innerException = jmsex.getLinkedException();
if (innerException != null) {
System.out.println("Inner exception(s):");
}
while (innerException != null) {
System.out.println(innerException);
innerException = innerException.getCause();
}
这些内部/链接异常可能包含MQ原因代码。
These inner/linked exceptions are likely to contain an MQ reason code.
在您的情况下,它应该有希望提供一些线索,说明连接失败的原因。例如,队列管理器名称错误,队列管理器未运行,客户端内部存在一些问题......
In your case, it should hopefully give some clues to why the connection has failed. For example, the queue manager name is wrong, the queue manager is not running, some internal problem within the client...
如果您发现更多信息但是仍在努力解决出现问题的方法,发布您找到的详细信息,我可以尝试进一步提供建议。
If you find more info but you're still struggling to work out what is going wrong, post the details you find and I can try to advise further.
这篇关于MQJMS2005异常无法创建MQQueueManager的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!