0

I am trying to add a jms listener to IBM mq, for replacing an MDB..I am getting below error. I have attached my spring config xml. I am able to send messages to queue with springconfiguration, but not able to receive!! I am able to get messages via MDB too, not via Spring JMS setup. I dont need a user id and password for MQ. Please advise.

        [9/26/17 16:02:25:905 CDT] 000000aa SystemOut     O 135778 [DefaultMessageListenerContainer-25] INFO  org.springframework.jms.listener.DefaultMessageListenerContainer  - Successfully refreshed JMS Connection
    [9/26/17 16:02:30:923 CDT] 000000ac SystemOut     O 140795 [DefaultMessageListenerContainer-26] WARN  org.springframework.jms.listener.DefaultMessageListenerContainer  - Setup of JMS message listener invoker failed for destination 'xyz.FADS.INITSTAT.Q' - trying to recover. Cause: JMSWMQ2008: Failed to open MQ queue 'xyz.FADS.INITSTAT.Q'.; nested exception is com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED').
    com.ibm.msg.client.jms.DetailedJMSSecurityException: JMSWMQ2008: Failed to open MQ queue 'xyz.FADS.INITSTAT.Q'.
    JMS attempted to perform an MQOPEN, but WebSphere MQ reported an error.
    Use the linked exception to determine the cause of this error. Check that the specified queue and queue manager are defined correctly.
        at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:516)
        at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:216)
        at com.ibm.msg.client.wmq.internal.WMQMessageConsumer.checkJmqiCallSuccess(WMQMessageConsumer.java:124)
        at com.ibm.msg.client.wmq.internal.WMQConsumerShadow.initialize(WMQConsumerShadow.java:959)
        at com.ibm.msg.client.wmq.internal.WMQSyncConsumerShadow.initialize(WMQSyncConsumerShadow.java:127)
        at com.ibm.msg.client.wmq.internal.WMQMessageConsumer.<init>(WMQMessageConsumer.java:252)
        at com.ibm.msg.client.wmq.internal.WMQSession.createConsumer(WMQSession.java:805)
        at com.ibm.msg.client.jms.internal.JmsSessionImpl.createConsumer(JmsSessionImpl.java:795)
        at com.ibm.msg.client.jms.internal.JmsSessionImpl.createConsumer(JmsSessionImpl.java:847)
        at com.ibm.msg.client.jms.internal.JmsQueueSessionImpl.createReceiver(JmsQueueSessionImpl.java:92)
        at com.ibm.mq.jms.MQQueueSession.createReceiver(MQQueueSession.java:121)
        at com.ibm.mq.jms.MQQueueSession.createConsumer(MQQueueSession.java:196)
        at org.springframework.jms.listener.AbstractMessageListenerContainer.createConsumer(AbstractMessageListenerContainer.java:881)
        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.createListenerConsumer(AbstractPollingMessageListenerContainer.java:217)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.initResourcesIfNecessary(DefaultMessageListenerContainer.java:1189)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1165)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1158)
        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1055)
        at java.lang.Thread.run(Thread.java:773)
    Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED').
        at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:204)

xml configuration is as below...

        <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:util="http://www.springframework.org/schema/util"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:cxf="http://cxf.apache.org/core"    
        xmlns:jaxrs="http://cxf.apache.org/jaxrs"
        xmlns:jaxws="http://cxf.apache.org/jaxws"    
        xmlns:jms="http://www.springframework.org/schema/jms"
        xsi:schemaLocation="
            http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/mvc
            http://www.springframework.org/schema/mvc/spring-mvc.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context.xsd  
            http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
            http://cxf.apache.org/jaxrs
            http://cxf.apache.org/schemas/jaxrs.xsd
            http://cxf.apache.org/jaxws
            http://cxf.apache.org/schemas/jaxws.xsd
            http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
            http://www.springframework.org/schema/jms
            http://www.springframework.org/schema/jms/spring-jms-4.1.xsd
            ">

        <import resource="classpath*:com/xyz/svc/component.xml"/>

        <mvc:annotation-driven enable-matrix-variables="true"/>
        <context:component-scan base-package="com.xyz.css.rplr.initst"></context:component-scan>

        <!-- WebSphere MQ Connection setup start -->
        <bean id="mqIdsConnectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory">
            <property name="hostName"><value>${xyz.company.MQ.HOST.NM}</value></property>
            <property name="port"><value>${xyz.company.MQ.PORT}</value></property>
            <property name="queueManager"><value>${xyz.company.MQ.QMNGR}</value></property>
            <property name="channel"><value>${xyz.company.MQ.CHANNEL}</value></property>
            <property name="CCSID"><value>819</value></property>
            <property name="transportType"><value>1</value></property>
        </bean>
        <bean id="jmsQueueIdsConnectionFactory"
            class="org.springframework.jms.connection.SingleConnectionFactory">
            <property name="targetConnectionFactory">
                <ref bean="mqIdsConnectionFactory" />
            </property>
        </bean>
        <bean id="jmsDestinationResolver"
            class="org.springframework.jms.support.destination.DynamicDestinationResolver">
        </bean>
        <bean id="jmsQueueIdsTemplate" class="org.springframework.jms.core.JmsTemplate">
            <property name="connectionFactory">
                <ref bean="jmsQueueIdsConnectionFactory" />
            </property>
            <property name="destinationResolver">
                <ref bean="jmsDestinationResolver" />
            </property> <!--    
            <property name="defaultDestinationName">
                <value>${xyz.company.MQ.INITST.Q}</value>
            </property>-->
            <property name="pubSubDomain">
                <value>false</value>
            </property>
            <property name="receiveTimeout">
                <value>20000</value>
            </property>
        </bean>

        <jms:annotation-driven/>

        <bean id="jmsListenerContainerFactory" class="org.springframework.jms.config.DefaultJmsListenerContainerFactory">
            <property name="connectionFactory">
                <ref bean="jmsQueueIdsConnectionFactory" />
            </property>
            <property name="destinationResolver">
                <ref bean="jmsDestinationResolver" />
            </property>
            <property name="concurrency" value="1" />
         </bean>
        <!-- WebSphere MQ Connection setup end -->
    </beans>
Jugunu
  • 141
  • 3
  • 14
  • 1
    What error shows in the queue managers `AMQERR01.LOG` when you receive the `MQRC_NOT_AUTHORIZED` error? You said you can use a MDB with no issue, does the MDB use the same connection details (channel, host, port)? – JoshMc Sep 26 '17 at 23:26
  • Thanks , I contacted the mq administrator, it was due to the queue setup and its working now. I will share the change once he updates me. – Jugunu Sep 27 '17 at 13:38

0 Answers0