title: Getting JmqiException RC=2538;AMQ9204 only from Linux MQSeries client
body: <p>I've been trying unsuccessfully to get a spring message driven pojo (MDP) to work in a test region (tomcat linux to mq server linux) after it works ok between two dev machines (windows tomcat client to linux server).</p>
  
  <p>Ports and spring configuration seem ok. Trace level logging shows all property values populated correctly. Another war can actually put on the MQ Queue using JMS from this test region tomcat server. This war uses the same tomcat context.xml file that points to the hostname of the MQ server. Resource references in context.xml and web.xml are ok. The listener is set up as described in <a href="https://stackoverflow.com/questions/12911628/getting-error-websphere-mq-reason-code-2538">Getting error : WebSphere MQ reason code 2538?</a></p>
  
  <p>The exception on the tomcat server comes from com.ibm.mq.jmqi which I understand is a stub to call JNI i.e., native C/C++ code presumably to be installed on the client. I was unclear whether you actually need to install the MQ client when you use JMS. We installed the MQ client but we still get this message. (Reading the docs more thoroughly I think I don't need the MQ Client. In fact, we removed it from the windows client to no ill effect)</p>
  
  <p>I find it odd that the exception is saying that it wants to connect to localhost. The server error files show nothing interesting. </p>
  
  <pre><code>  ****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.&lt;init&gt;(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.&lt;init&gt;(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]
  </code></pre>