Topic
  • 1 reply
  • Latest Post - ‏2016-12-12T15:11:09Z by fjb_saper
exception01
exception01
1 Post

Pinned topic How to enable MQCSP authentication in IBM MQ using spring JMS and websphere?

‏2016-11-29T16:56:36Z |

The problem is, using spring JMS 4.2.4, websphere application server 8.5 and IBM MQ 9, if I set the MQ password with less than 12 characters, it can successfully connect but if the password is more than 12 characters, it returns Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED').

I've read that the default compatibility mode should be disabled in order to allow the password that is longer than 12 characters. In short, MQCSP authentication should be enabled but how to do it in spring JMS and/or websphere?

- To set this mode operation on a connection in MQ Classes for Java, set the property MQConstants.USE_MQCSP_AUTHENTICATION_PROPERTY to true in the properties hashtable passed to the com.ibm.mq.MQQueueManager constructor.

Question: Are we going to set this property in WAS and how?

- To set this mode operation on a connection in MQ Classes for JMS, set the property JMSConstants.USER_AUTHENTICATION_MQCSP to true on the appropriate connection factory prior to creating the connection

Question: Are we going to set this property in WAS and how?

- To set this mode globally, set the System Property "com.ibm.mq.cfg.jmqi.useMQCSPauthentication" to a value indicating true, for example by adding "-Dcom.ibm.mq.cfg.jmqi.useMQCSPauthentication=Y" to the command line 

Question: How to set this in websphere?

This is how we create the queue connection factory. Since the queue connection factory is from WAS JNDI, where do we need to set the MQCSP authentication? Are we going to set it in websphere?

Here is the cxf-servlet.xml



<bean id="mqConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="jms/queueConnFactoryDEV" />
    <property name="lookupOnStartup" value="false" />
    <property name="cache" value="true" />
    <property name="proxyInterface" value="javax.jms.QueueConnectionFactory" />
</bean>

<bean id="connectionFactory"
    class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
    <property name="targetConnectionFactory" ref="mqConnectionFactory" />
    <property name="username" value="userdev" />
    <property name="password" value="P@ssw0rd12345678" />
</bean>

<bean
    class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />

<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
    <property name="connectionFactory" ref="connectionFactory" />
    <property name="defaultDestinationName" value="MQ.DEV" />
</bean>

Thank you in advance.

Updated on 2016-12-05T10:34:03Z at 2016-12-05T10:34:03Z by exception01
  • fjb_saper
    fjb_saper
    240 Posts

    Re: How to enable MQCSP authentication in IBM MQ using spring JMS and websphere?

    ‏2016-12-12T15:11:09Z  

    You need to add an additional property to your connection factory to have it use MQCSP. You wil find the property name in the MQConstants / JMSConstants...