title: SSL Java Client for WebSphere MQ
body: <p>I try to develop a test client (Java web application) for WebSphere MQ via Spring. </p>
  
  <p>I've enabled the SSL security mechanism for the channel, queue manager and connection factory, using the NULL_MD5 cipher spec.</p>
  
  <p>This is my Spring configuration file:</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:context="http://www.springframework.org/schema/context"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context-2.5.xsd
   http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"&gt;
  
      &lt;context:annotation-config/&gt;
  
      &lt;context:property-placeholder location="classpath:jms.properties"/&gt;
  
      &lt;bean id="jmsFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory"&gt;
          &lt;property name="hostName" value="${queue_hostname}"/&gt;
          &lt;property name="queueManager" value="${queue_manager}"/&gt;
          &lt;property name="channel" value="${queue_channel}"/&gt;
          &lt;property name="port" value="${queue_port}"/&gt;
          &lt;property name="transportType" value="1"/&gt;
          &lt;property name="SSLCipherSuite" value="SSL_RSA_WITH_NULL_MD5"/&gt;
      &lt;/bean&gt;
  
      &lt;bean id="sendDestination" class="com.ibm.mq.jms.MQQueue"&gt;
          &lt;property name="baseQueueName"&gt;
              &lt;value&gt;queue.inbound&lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate"&gt;
          &lt;property name="connectionFactory"&gt;
              &lt;bean class="org.springframework.jms.connection.SingleConnectionFactory"&gt;
                  &lt;property name="targetConnectionFactory"&gt;
                      &lt;ref local="jmsFactory" /&gt;
                  &lt;/property&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
          &lt;property name="defaultDestination"&gt;
              &lt;ref bean="sendDestination" /&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
  
      &lt;bean id="messageListener" class="com.test.MessageListener" /&gt;
  
      &lt;bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer"&gt;
          &lt;property name="connectionFactory"&gt;
              &lt;bean class="org.springframework.jms.connection.SingleConnectionFactory"&gt;
                  &lt;property name="targetConnectionFactory"&gt;
                      &lt;ref local="jmsFactory" /&gt;
                  &lt;/property&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
          &lt;property name="destination" ref="sendDestination" /&gt;
          &lt;property name="messageListener" ref="messageListener" /&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>The problem is when I try to connect to the WebSphere MQ an exception raises:</p>
  
  <pre><code>Caused by: org.springframework.context.ApplicationContextException: Failed to start bean 'jmsContainer'; nested exception is java.lang.AssertionError
      at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:170)
      at org.springframework.context.support.DefaultLifecycleProcessor.access$1(DefaultLifecycleProcessor.java:154)
      at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:339)
      at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:143)
      at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:108)
      at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:926)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:467)
      at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:103)
      at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
      at org.springframework.test.context.support.DelegatingSmartContextLoader.loadContext(DelegatingSmartContextLoader.java:228)
      at org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:124)
      at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:148)
      ... 27 more
  Caused by: java.lang.AssertionError
      at com.ibm.mq.jmqi.internal.CipherSpec.&lt;init&gt;(CipherSpec.java:53)
      at com.ibm.mq.jmqi.JmqiUtils.toCipherSuite(JmqiUtils.java:325)
      at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.parseCipherSpec(RemoteTCPConnection.java:1984)
      at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.makeSocketSecure(RemoteTCPConnection.java:1838)
      at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.connnectUsingLocalAddress(RemoteTCPConnection.java:810)
      at com.ibm.mq.jmqi.remote.impl.RemoteTCPConnection.protocolConnect(RemoteTCPConnection.java:1130)
      at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:710)
      at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:400)
      at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:299)
      at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:164)
      at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1595)
      at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1223)
      at com.ibm.mq.ese.jmqi.InterceptedJmqiImpl.jmqiConnect(InterceptedJmqiImpl.java:311)
      at com.ibm.mq.ese.jmqi.ESEJMQI.jmqiConnect(ESEJMQI.java:337)
      at com.ibm.msg.client.wmq.internal.WMQConnection.&lt;init&gt;(WMQConnection.java:346)
      at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:6876)
      at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:6254)
      at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:285)
      at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6189)
      at com.ibm.mq.jms.MQQueueConnectionFactory.createQueueConnection(MQQueueConnectionFactory.java:120)
      at com.ibm.mq.jms.MQQueueConnectionFactory.createConnection(MQQueueConnectionFactory.java:203)
      at org.springframework.jms.connection.SingleConnectionFactory.doCreateConnection(SingleConnectionFactory.java:342)
      at org.springframework.jms.connection.SingleConnectionFactory.initConnection(SingleConnectionFactory.java:288)
      at org.springframework.jms.connection.SingleConnectionFactory.createConnection(SingleConnectionFactory.java:225)
      at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)
      at org.springframework.jms.listener.AbstractJmsListeningContainer.createSharedConnection(AbstractJmsListeningContainer.java:403)
      at org.springframework.jms.listener.AbstractJmsListeningContainer.establishSharedConnection(AbstractJmsListeningContainer.java:371)
      at org.springframework.jms.listener.DefaultMessageListenerContainer.establishSharedConnection(DefaultMessageListenerContainer.java:750)
      at org.springframework.jms.listener.AbstractJmsListeningContainer.doStart(AbstractJmsListeningContainer.java:278)
      at org.springframework.jms.listener.AbstractJmsListeningContainer.start(AbstractJmsListeningContainer.java:263)
      at org.springframework.jms.listener.DefaultMessageListenerContainer.start(DefaultMessageListenerContainer.java:556)
      at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:167)
      ... 38 more
  </code></pre>
  
  <p>It is strange that even though I set the SSLCipherSuite property it tries to get the cipher suite by the cipher spec...</p>
  
  <p>Can someone please suggest how to fix this?</p>