开发者

get 2035 on connecting to the base queue

开发者 https://www.devze.com 2023-01-10 05:30 出处:网络
I am running a simple Java client to connect to a remote MQ queue. When I run the Java code to read write messages with Alias queue name, it works fine.

I am running a simple Java client to connect to a remote MQ queue.

  1. When I run the Java code to read write messages with Alias queue name, it works fine.

  2. When i try to run the code on the same queue but witha a physical queue name (Because i wish to invoke getQueueDepth), I get a 2035 error at the point when the code tries to establish a connection

The authority on the queue are: browse +dsp +get +inq +put +set +setall

The java code is as under

import com.ibm.mq.MQC; import com.ibm.mq.MQEnvironment; import com.ibm.mq.MQException; import com.ibm.mq.MQGetMessageOptions; import com.ibm.mq.MQMessage; import com.ibm.mq.MQPutMessageOptions; import com.ibm.mq.MQQueue; import com.ibm.mq.MQQueueManager; public class MQSniffer {

/**
 * @param args
 */
/**
 * @param args
 */
public static void main(String[] args) {
    String hostname = "XXXX";     
    String channel开发者_Go百科  = "CHANNEL";  
    String qManager = "qmgr";  

    MQQueueManager qMgr;                      


    MQEnvironment.hostname = hostname;          
    MQEnvironment.channel  = channel;            
    MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);

    try {  
    qMgr = new MQQueueManager(qManager);  

    int openOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_INQUIRE | MQC.MQOO_OUTPUT ;

    MQQueue system_default_local_queue =  
    qMgr.accessQueue("PHYSICAL_QUEUE_NAME",  // *****Get an exception on this call*****
    openOptions,  
    null,           
    null,            
    null);           

    System.out.println("****Current Depth is "+ system_default_local_queue.getCurrentDepth());

    MQMessage hello_world = new MQMessage();  
    hello_world.writeUTF("Hello World!");  


    MQPutMessageOptions pmo = new MQPutMessageOptions();   


    system_default_local_queue.put(hello_world,pmo);  
    System.out.println("Put the message");


    system_default_local_queue.close();  

    // Disconnect from the queue manager  

    qMgr.disconnect();  

    }  

    catch (MQException ex)  
    {  
    System.out.println("An MQSeries error occurred : Completion code " +  
    ex.completionCode +  
    " Reason code " + ex.reasonCode);  

    ex.printStackTrace();
    }  
    catch (java.io.IOException ex)  
    {  
    System.out.println("An error occurred whilst writing to the  message buffer: " + ex);  
    }  



}

}


om.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 2035 at com.ibm.mq.MQQueueManager.accessQueue(MQQueueManager.java:2858) at org.ku.benchmarkos.MQSniffer.main(MQSniffer.java)

Any help is appreciated!

Thanks J


WMQ checks permissions on the first object encountered. So if you open an alias, the permissions are checked on the alias and not the base queue. If you open a base queue, the permissions are checked on the base queue and not on any aliases that may point to it. There is no expectation that the ability to open an alias implies an ability to open the base queue. One would need to run setmqaut against both the alias and the base queue with the appropriate permissions.

I have a longer explanation posted here: Understanding WebSphere MQ authorization and the setmqaut command.


If the permissions are set to the alias, you will be able to access the queue only via alias. The same is valid if you have permissions set on the queue you will be able to access the queue only via the real queue name and not via the alias.


2035 is insufficient permissions - you will need to ask your MQ administrator to assist.

0

精彩评论

暂无评论...
验证码 换一张
取 消