获取JmqiException RC = 2538; AMQ9204仅来自Linux MQSeries客户端

时间:2013-12-05 19:53:24

标签: linux spring tomcat ibm-mq

在两台开发机器(windows tomcat客户端到linux服务器)之间正常工作之后,我一直尝试让弹簧消息驱动的pojo(MDP)在测试区域(tomcat linux到mq服务器linux)中工作。

端口和弹簧配置似乎没问题。跟踪级别日志记录显示正确填充的所有属性值。另一场战争实际上可以使用来自此测试区域tomcat服务器的JMS来安装MQ Queue。此war使用相同的tomcat context.xml文件,该文件指向MQ服务器的主机名。 context.xml和web.xml中的资源引用都可以。监听器的设置如Getting error : WebSphere MQ reason code 2538?

中所述

tomcat服务器上的异常来自com.ibm.mq.jmqi,据我所知,它是一个调用JNI的存根,即可能是安装在客户端上的本机C / C ++代码。我不清楚在使用JMS时是否确实需要安装MQ客户端。我们安装了MQ客户端,但仍然收到此消息。 (更彻底地阅读文档我认为我不需要MQ客户端。事实上,我们将它从Windows客户端删除,没有任何不良影响)

我觉得很奇怪异常是说它要连接到localhost。服务器错误文件没有任何意义。

  ****Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9204: Connection to host 'localhost(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2538;AMQ9213****


org.springframework.jms.listener.DefaultMessageListenerContainer]
Dec 05 15:22:26 DEBUG org.springframework.jms.listener.DefaultMessageListenerContainer - Could not establish shared JMS Connection - leaving it up to asynchronous invokers to establish a Connection as soon as possible
com.ibm.msg.client.jms.DetailedIllegalStateException: JMSWMQ0018: Failed to connect to queue manager 'QMTST' with connection mode 'Client' and host name 'localhost(1414)'.
    at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:479) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:221) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:426) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:6902) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6390) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:285) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6233) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:120) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.mq.jms.MQQueueConnectionFactory.createConnection(MQQueueConnectionFactory.java:203) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_24]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_24]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_24]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_24]
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) ~[spring-aop-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:198) ~[spring-aop-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at $Proxy8.createConnection(Unknown Source) ~[na:na]
    at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184) ~[spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.jms.listener.AbstractJmsListeningContainer.createSharedConnection(AbstractJmsListeningContainer.java:405) [spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.jms.listener.AbstractJmsListeningContainer.establishSharedConnection(AbstractJmsListeningContainer.java:373) [spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer.establishSharedConnection(DefaultMessageListenerContainer.java:760) [spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.jms.listener.AbstractJmsListeningContainer.doStart(AbstractJmsListeningContainer.java:280) [spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.jms.listener.AbstractJmsListeningContainer.start(AbstractJmsListeningContainer.java:265) [spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.jms.listener.DefaultMessageListenerContainer.start(DefaultMessageListenerContainer.java:561) [spring-jms-3.2.3.RELEASE.jar:3.2.3.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:167) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:339) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:143) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:108) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:945) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) [spring-context-3.2.4.RELEASE.jar:3.2.4.RELEASE]
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389) [spring-web-3.2.4.RELEASE.jar:3.2.4.RELEASE]
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294) [spring-web-3.2.4.RELEASE.jar:3.2.4.RELEASE]
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112) [spring-web-3.2.4.RELEASE.jar:3.2.4.RELEASE]
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791) [catalina.jar:7.0.29]
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285) [catalina.jar:7.0.29]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:7.0.29]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) [catalina.jar:7.0.29]
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) [catalina.jar:7.0.29]
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618) [catalina.jar:7.0.29]
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:963) [catalina.jar:7.0.29]
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1600) [catalina.jar:7.0.29]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [na:1.6.0_24]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [na:1.6.0_24]
    at java.util.concurrent.FutureTask.run(FutureTask.java:138) [na:1.6.0_24]
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_24]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_24]
    at java.lang.Thread.run(Thread.java:662) [na:1.6.0_24]
Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2538' ('MQRC_HOST_NOT_AVAILABLE').
    at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:209) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    ... 45 common frames omitted
**Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9204: Connection to host 'localhost(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2538;AMQ9213**: A communications error for  occurred. [1=java.net.ConnectException[Connection refused],3=localhost]],3=localhost(1414),5=RemoteTCPConnection.connnectUsingLocalAddress]
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2053) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1226) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:311) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:337) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:346) ~[com.ibm.mqjms-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    ... 44 common frames omitted
Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2538;AMQ9213: A communications error for  occurred. [1=java.net.ConnectException[Connection refused],3=localhost]
    at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.connnectUsingLocalAddress(RemoteTCPConnection.java:810) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1140) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:724) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:400) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:299) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:164) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1598) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    ... 48 common frames omitted
Caused by: java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.6.0_24]
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351) ~[na:1.6.0_24]
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213) ~[na:1.6.0_24]
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200) ~[na:1.6.0_24]
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) ~[na:1.6.0_24]
    at java.net.Socket.connect(Socket.java:529) ~[na:1.6.0_24]
    at java.net.Socket.connect(Socket.java:478) ~[na:1.6.0_24]
    at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$5.run(RemoteTCPConnection.java:795) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection$5.run(RemoteTCPConnection.java:789) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.6.0_24]
    at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.connnectUsingLocalAddress(RemoteTCPConnection.java:787) ~[com.ibm.mq.jmqi-7.5.jar:7.5.0.2 - p750-002-130704.TRIAL]

2 个答案:

答案 0 :(得分:1)

我们发现它从基于MQ文件的JNDI绑定文件中获取localhost。它看起来像一个黑客,但我们只是将.bindings文件中的localhost更改为MQ服务器的IP,然后就可以了。

在.bindings文件中找到QMGR匹配名称后,它永远不会查看Tomcat context.xml文件。

答案 1 :(得分:0)

该异常清楚地表明应用程序正在尝试连接到同一台计算机上的队列管理器。这意味着您的配置不正确。您必须编辑配置文件以提供主机名和端口号。

Btw MQ JMS在客户端(通过TCP套接字)模式下连接时不使用本机c库。这都是Java。