Search code examples
javajakarta-eejmsibm-mqweblogic11g

Migration from mq version 7.0 to 7.5


I am Migrating from Mq version 7.0 to 7.5 . I am able to receive messages through the inbound queues using ejb - Message Driven Beans(MDBs) but while posting the message after processing it on the. I am getting the IBM MQRC 2082 MQRC_UNKOWN_ALIAS_BASE_Q Exception.

This is the exception that I am getting :

Caused by: javax.jms.InvalidDestinationException: MQJMS2008: failed to open MQ queue 'OFS.TIG_IND2NSE_MSG'. at com.ibm.msg.client.wmq.v6.jms.internal.MQQueueServices.getQueueOpenException(MQQueueServices.java:901) at com.ibm.msg.client.wmq.v6.jms.internal.MQQueueServices.getOutputQueue(MQQueueServices.java:727) at com.ibm.msg.client.wmq.v6.jms.internal.JMSServicesMgr.getOutputQueue(JMSServicesMgr.java:210) at com.ibm.msg.client.wmq.v6.jms.internal.MQSession.createQProducer(MQSession.java:3138) at com.ibm.msg.client.wmq.v6.jms.internal.MQSession.createProducer(MQSession.java:2863) at com.ibm.msg.client.wmq.v6.jms.internal.MQSession.createProducer(MQSession.java:2920) at com.ibm.msg.client.jms.internal.JmsSessionImpl.createProducer(JmsSessionImpl.java:1191) at com.ibm.msg.client.jms.internal.JmsXAQueueSessionImpl$1.createSender(JmsXAQueueSessionImpl.java:415) at com.ibm.mq.jms.MQQueueSession.createSender(MQQueueSession.java:148) at weblogic.deployment.jms.WrappedSession.createSender(WrappedSession.java:344) at com.tiger.gmfs.framework.jms.QUtil.getSender(QUtil.java:216) at com.tiger.gmfs.framework.jms.QUtil.sendMessage(QUtil.java:110)

The piece of code that i wrote is : this is my getSender method: protected QueueSender getSender() throws JavaMessagingException, JMSException {

    QueueSender sender = null;
    queue = qsess.createQueue(qVO.getName());
    sender =  qsess.createSender(queue);
    if (sender == null)
        throw new JavaMessagingException("The queue sender is null.");


    sender.setPriority(qVO.getPriority());
    return sender;
}

and this is my sendMessage method:

public void sendMessage(Message jmsMessage) throws JavaMessagingException,
            JMSException {
        QueueSender sender = null;
        try {
            sender = getSender();
            sender.send(jmsMessage);
        } catch (JMSException j) {
            Exception l = j.getLinkedException();
            if (l != null) {
                JavaMessagingException be = new JavaMessagingException(
                        "JMSErrCode:" + l + " Code:" + j.getErrorCode()
                                + " Message: " + jmsMessage, j);
                throw be;
            } else
                throw new JavaMessagingException(j);
        }catch(Exception e1){
            System.out.println(e1);
        }finally {

            if (sender != null) {
                sender.close();
                TracingHelper.infoLog(QUtil.class, "sendMessage",
                        "Closed sender");
            }
        }
    }

What changes should i do here that my code works?

I have Implemented the same code in jre 1.7 +weblogic 12c that works perfectly but when i changed it to jre 1.6 + weblogic 11g, i get this error.


Solution

  • From a development point of view, when an application opens the queue - the developer has to make sure that the right open options are used to open a WebSphere MQ queue.

    If the application wants to put a message, open the queue with MQOO_OUTPUT open option and not any of the MQOO_INPUT* options.

    If the application wants to get a message, open the queue with any one of the below open options, but not all at the same time MQOO_INPUT_SHARED MQOO_INPUT_EXCLUSIVE MQOO_INPUT_AS_Q_DEF

    The reason being, if the queue being opened is an alias queue pointing to a base queue in the same queue manager where the alias queue is present, and the base queue is a local queue - both, the OUTPUT and INPUT open options are valid.

    However, if the alias queue being opened is pointing to a remote queue or a topic in the same queue manager where the alias queue is present, or if the alias queue is pointing to a cluster local queue present in a different queue manager in the cluster, all of the MQOO_INPUT* open options are invalid in this scenario.

    Hence it is always advisable to open a WebSphere MQ queue only and only with the appropriate open options required for the operation being performed.

    In your case, if you are trying to open the alias queue with any of the MQOO_INPUT* open option, and it is pointing to a cluster local queue in a different queue manager, it is incorrect. You have to remove the MQOO_INPUT* open option from your code to resolve the issue, as the MQOO_INPUT* option is not valid in this scenario.