ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexIBM MQ API Support2035 - MQRC_NOT_AUTHORIZED Error

Post new topicReply to topic
2035 - MQRC_NOT_AUTHORIZED Error View previous topic :: View next topic
Author Message
digvijay
PostPosted: Wed Jul 20, 2016 6:11 am Post subject: 2035 - MQRC_NOT_AUTHORIZED Error Reply with quote

Newbie

Joined: 20 Jul 2016
Posts: 2

I am using IBM MQ Client V9.0 with C#.NET. I tried code with or without setting UserID and Password. I am using "mqm" for User_ID and password. I don't have any other user details. SSL/TLS is also not configured on server. I am able to connect to server using IBM MQ Explorer.

In MQ Explorer, I followed following steps
1. Chose "Connect Directly" in 1st step
2. Enter Host Name, Port and Channel.
3. Didn't select the "Enable Security Exit"
4. Select "Enable user Identification" and "User Identification compability mode". Enter user id and choose "No Password" and then Finish.

Connection worked in MQ Explorer but my Dot net code is not working.

Code:

        public MQQueueManager createQueueManager()
        {

            MQQueueManager queueManager = null;

            // Setup connection information

            string queueManagerName = "mgr_beta_in";

            queueProperties = new Hashtable();

            queueProperties.Add(MQC.HOST_NAME_PROPERTY, "HOST_NAME");

            queueProperties.Add(MQC.PORT_PROPERTY, 1417);

            queueProperties.Add(MQC.CHANNEL_PROPERTY, "CHANNEL");

            //queueProperties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);

            //queueProperties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_XACLIENT);

            //queueProperties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED);

            queueProperties.Add(MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_CLIENT);

            queueProperties.Add(MQC.USE_MQCSP_AUTHENTICATION_PROPERTY, true);

            queueProperties.Add(MQC.USER_ID_PROPERTY, "mqm");

            queueProperties.Add(MQC.PASSWORD_PROPERTY, "mqm");

            try
            {
                queueManager = new MQQueueManager(queueManagerName, queueProperties);

                Console.WriteLine("Connected Successfully");
            }

            catch (MQException mqexp)
            {

                Console.WriteLine("MQSeries Exception: " + mqexp.Message);

                Console.WriteLine("MQSeries Exception: " + mqexp.Reason);

                Console.WriteLine("MQSeries Exception: " + mqexp.StackTrace);

                //see list of Reason Codes at http://russsutton.com/developer/?p=45

            }



            return queueManager;

        }




I also tried IBM.XMS also. In below code "connectionWPM = connectionFactory.CreateConnection();" doesn't return any error and but when i used the connectionWPM object for creating session then it returned the below error

--------------- Error -------------------------
Exception thrown: 'System.NullReferenceException' in IBM.XMS.Client.Impl.dll

Additional information: Object reference not set to an instance of an object.
----------------------------------------------------

Code:

            XMSFactoryFactory factoryFactory;
            IConnectionFactory connectionFactory;
            IConnection connectionWPM;
            ISession sessionWPM;
            IDestination destination;
            Requestor requestor;
            ITextMessage textRequestMessage;
            ITextMessage textResponseMessage;

            //Read config values
            string QueueManager = "QueueManager";
            string Channel = "Channel";
            string Host = "Host";
            int Port = 1417;

            //Create connection
            factoryFactory = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
            connectionFactory = factoryFactory.CreateConnectionFactory();

            connectionFactory.SetStringProperty(XMSC.WMQ_QUEUE_MANAGER, QueueManager);
            connectionFactory.SetStringProperty(XMSC.WMQ_HOST_NAME, HostIP);
            connectionFactory.SetIntProperty(XMSC.WMQ_PORT, Port);
            connectionFactory.SetStringProperty(XMSC.WMQ_CHANNEL, Channel);
            connectionFactory.SetIntProperty(XMSC.WMQ_BROKER_VERSION, XMSC.WMQ_BROKER_V2);
            //connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT_UNMANAGED);
            //connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_CLIENT);
            connectionFactory.SetIntProperty(XMSC.WMQ_CONNECTION_MODE, XMSC.WMQ_CM_DIRECT_HTTP);
            connectionFactory.SetStringProperty(XMSC.USERID, "mqm");
            connectionFactory.SetStringProperty(XMSC.PASSWORD, "mqm");

            connectionFactory.SetIntProperty(XMSC.WMQ_CLIENT_RECONNECT_OPTIONS, XMSC.WMQ_CLIENT_RECONNECT_Q_MGR);
            connectionFactory.SetIntProperty(XMSC.WMQ_CLIENT_RECONNECT_TIMEOUT, 30); ;

            Console.WriteLine("Creating connection");

            try
            {
                connectionWPM = connectionFactory.CreateConnection();

                sessionWPM = connectionWPM.CreateSession(false, AcknowledgeMode.AutoAcknowledge);

                destination = sessionWPM.CreateQueue("Test");

                requestor = new Requestor(sessionWPM, destination);

                // Start the connection to receive messages.
                connectionWPM.Start();

                //// Create a text message and send it.
                //textRequestMessage = sessionWPM.CreateTextMessage(request);
                //textResponseMessage = (ITextMessage)requestor.Request(textRequestMessage);

                //Console.Write(textResponseMessage);

                //requestor.Dispose();
                //destination.Dispose();
                //sessionWPM.Dispose();
                //connectionWPM.Close();

                Console.Read();
            }
            catch(XMSException ex)
            {
                string str = ex.ErrorCode;
            }
Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Jul 20, 2016 6:31 am Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6077
Location: Somewhere over the Rainbow this side of Never-never land.

So you have
Code:

           //Read config values
            string QueueManager = "QueueManager";
            string Channel = "Channel";
            string Host = "Host";
            int Port = 1417;

or are these obfuscated?

You have to set a number of things in the Queue Manager in order to get a client connection.
There are a good number of posts here about the MQ V9 security settings. Have you done anything to the queue manager apart from creating the MQ Objects?

When you connect what do the events shown in AMQERR01.log show?
also you should not be ujsing the MQM USer at all.
Plus the MQ9 QMGR settings will play an important part in your ability to connect especially if user account/password are needed at all or what sort of validatino they are subject to.
Talk to your MQ admins to get help.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jul 20, 2016 6:38 am Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17311

If you're building a client connection, you should either use the queue manager name (for a ccdt) or the channel/host/port.

And not both.
_________________
Read, Think, Try, Repeat
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jul 20, 2016 7:42 am Post subject: Reply with quote

Grand Poobah

Joined: 18 Nov 2003
Posts: 19218
Location: LI,NY

Looking at your XMS code, the properties on the connection factory for user and password have absolutely no effect at all.

You use those when you create the connection:
Code:
connection = connectionfactory.createConnection(username, password);

Or when creating the JMSContext....

I can only underscore all the good advice about security and queue manager setup given by my esteemed colleagues. Look up following terms in the infocenter: Connauth, chlauth.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
digvijay
PostPosted: Thu Jul 21, 2016 2:34 am Post subject: Reply with quote

Newbie

Joined: 20 Jul 2016
Posts: 2

smdavies99 wrote:
So you have
Code:

           //Read config values
            string QueueManager = "QueueManager";
            string Channel = "Channel";
            string Host = "Host";
            int Port = 1417;

or are these obfuscated?


Yes, I have details of QueueManager, Channel and Host. I don't have access of server where WebSphere server is installed. I am able to connect to server using MQ Explorer. For connecting to server using MQExplorer, I followed the below steps

1. Choose "Connect Directly" in 1st step
2. Enter Host Name, Port and Channel.
3. Didn't select the "Enable Security Exit"
4. Select "Enable user Identification" and "User Identification compability mode". Enter user id and choose "No Password" and then Finish.

Quote:
You have to set a number of things in the Queue Manager in order to get a client connection.
There are a good number of posts here about the MQ V9 security settings. Have you done anything to the queue manager apart from creating the MQ Objects?


No, I didn't set anything. I just set those properties which I mentioned in my code.

Quote:
When you connect what do the events shown in AMQERR01.log show?
also you should not be ujsing the MQM USer at all.
Plus the MQ9 QMGR settings will play an important part in your ability to connect especially if user account/password are needed at all or what sort of validatino they are subject to.
Talk to your MQ admins to get help.`


I don't have access of server. I can't check log or can't do any settings.

Please let me know if I missing something in my code.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Thu Jul 21, 2016 3:41 am Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6077
Location: Somewhere over the Rainbow this side of Never-never land.

Do you have full MQ on the system that you are running this application on?
If so, why not create a local QMGR and test it against that QM using a client connection.
Then you can set the right MQ QMGR and object options.
When it is all working then you can supply the people who manage the System that you don't have access to so that they can setup the QMGR and objects correctly.

Also, have you asked the people who manage the QMGR for the logs?
If they won't then they have to have a really good business reason for not helping you get your code to work.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexIBM MQ API Support2035 - MQRC_NOT_AUTHORIZED Error
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.