我们正在使用以下代码和设置来连接到iSeries上的IBM Websphere Message Queue(版本IBM®WebSphere®MQ V6.0.1)。

我们针对相同的MQ为三个不同的应用程序使用相同的uid和pwd

我们整天间歇性地收到MQRC_NOT_AUTHORIZEDMQRC_Q_MGR_NOT_AVAILABLE错误,但始终在“获取消息”方法上。

设定:

使用以下设置创建连接属性的哈希表:

MQC.TRANSPORT_PROPERTY = MQC.TRANSPORT_MQSERIES_MANAGED
MQC.CHANNEL_PROPERTY    = SYSTEM.DEF.SVRCONN
MQC.HOST_NAME_PROPERTY = IP Address


我们使用以下打开选项:

MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_INQUIRE

class WebSphereMQ
{
    public bool impStatus { get; set; }

    public MQQueueManager gMQQueueManager;
    public MQQueue gMQQueue;
    private MQMessage queueGetMessage { get; set; }
    private MQGetMessageOptions queueGetMessageOptions { get; set; }

    public MQQueueManager pMQQueueManager;
    public MQQueue pMQQueue;
    private MQMessage queuePutMessage { get; set; }
    private MQPutMessageOptions queuePutMessageOptions { get; set; }

    public WebSphereMQ()
    {
        impStatus = impersonation.impersonateValidUser(Common.impNme, "", Common.impPwd);

        gMQQueueManager = null;
        gMQQueue = null;

        if (gMQQueue != null && gMQQueue.IsOpen)
        {
            // Just incase
            gMQQueue.Close();
            gMQQueueManager.Disconnect();
        }
    }

    public bool connectMQGet(string QMgr, string QName, Hashtable connectionProperties, bool BrowseOnly, string QType)
    {
        try
        {
            gMQQueueManager = new MQQueueManager(QMgr, connectionProperties);
            if (gMQQueueManager != null && QType == "OUT")
            {
                if (BrowseOnly)
                    gMQQueue = gMQQueueManager.AccessQueue(QName, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_BROWSE + MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_INQUIRE);
                else
                    gMQQueue = gMQQueueManager.AccessQueue(QName, MQC.MQOO_INPUT_AS_Q_DEF + MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_INQUIRE);
            }
        }
        catch (MQException mqe)
        {
            if (impStatus) impersonation.undoImpersonation();
            /* Write to log */
            Common.logBuilder("WebSphereMQ --> connectMQGet <--", "MQException", Common.ActiveMQ, mqe.Message, "Exception");
            /* Send email to support */
            emailer.exceptionEmail(mqe);
            return false;
        }
        return true;
    }


这是错误和堆栈跟踪的示例:

An MQException has happened on 30 June 2015 at 08:52A
Message ---
MQRC_NOT_AUTHORIZED
HelpLink ---
Source ---
amqmdnet
StackTrace ---
     at IBM.WMQ.MQBase.throwNewMQException() at IBM.WMQ.MQQueueManager.Connect(String queueManagerName) at IBM.WMQ.MQQueueManager..ctor(String queueManagerName, Hashtable properties) at EvryCardManagement.WebSphereMQ.connectMQGet(String QMgr, String QName, Hashtable connectionProperties, Boolean BrowseOnly, String QType)


那么,是否有一些我可以在客户端进行更改的设置可以防止我们收到这些异常,还是需要在iSeries / MQ上进行一些修改?

我们是否应该为使用MQ的三个不同应用程序尝试使用不同的uid?

最佳答案

MQ V6早已退出服务。您将需要将队列管理器升级到受支持的版本。

就2035年例外而言,有多种解决方法:

1)您的MQ .NET应用程序必须在iSeries上存在的用户标识,并且具有连接到队列管理器的权限。

2)在iSeries队列管理器上的SYSTEM.DEF.SVRCONN上设置MCAUSER。

关于2035个原因码的文章很多。查看T.Rob的以下帖子以及这些帖子中的链接。

Authorization with Websphere MQ 6

WebSphere 7, configuring JMS Q connection factory without user id: MQRC_NOT_AUTHORIZED

关于c# - 从iSeries Websphere消息队列获取消息时的MQRC_错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31135409/

10-15 02:54