0
votes

I am using IBM MQ version 7.5 (trial version)

I have created a two queue managers (QM1 and QM2)

Under the QM1:
port : 1421
Queues: q1(local queue)
channel: ch1 (receiver)

Under the QM2:
port :1422
Queues:q2(transmission queue),q3(remote queue)
channel:ch1 (sender)

I can send the messages through QM2's queue q3 to QM1's queue q1. I can also receive and browse the messages through the q2.

But when I use the java to read the messages from q1 I have an error

MQJE001: An MQException occurred: Completion Code 2, Reason 2009   
MQJE016: MQ queue manager closed channel immediately during connect    
Closure reason = 2009    
MQJE001: Completion Code 2, Reason 2009 

When I check with the IBM site they said it can cause the due to the below reasons
http://www-01.ibm.com/support/docview.wss?uid=swg21226703

  1. A firewall has terminated the connection.
  2. An IOException caused the socket to be closed.
  3. An explicit action caused the socket to be closed by one end.
  4. The queue manager is offline.
  5. The maximum number of channels allowed by the queue manager are already open.
  6. A configuration problem in the Queue Connection Factory (QCF).

But all of the above are looks good in my system. what I missing , Kindly let me know.

public static void main(String[] args) throws MQException {

MQEnvironment.hostname="localhost";
MQEnvironment.channel="ch1";
MQEnvironment.port=1421;
MQQueueManager qMgr= new MQQueueManager("QM1");
MQQueue outputQueue =qMgr.accessQueue("q1", MQC.MQOO_INQUIRE | MQC.MQOO_BROWSE | MQC.MQOO_INPUT_AS_Q_DEF);


//Checking for messages in queue
int i=outputQueue.getCurrentDepth();
System.out.println("Number of messages in  queue: "+i);


outputQueue.close();
qMgr.close();
qMgr.disconnect();
}

Adding:

version of the jar :

C:\Program Files (x86)\IBM\WebSphere MQ\java\lib>java -cp ./com.ibm.mq.jar com.ibm.mq.MQJavaLevel
Name: WebSphere MQ classes for Java
Version: 7.5.0.2
Level: p750-002-130627
Build Type: Production

After changing the channel I have received the below error

    ----- amqrmrsa.c : 898 --------------------------------------------------------
10/20/2017 02:17:37 - Process(16340.40) User(MUSR_MQADMIN) Program(amqrmppa.exe)
                     Host(user1) Installation(Installation1)
                     VRMF(7.5.0.2) QMgr(Receiver)

AMQ9777: Channel was blocked

EXPLANATION:
The inbound channel 'SYSTEM.DEF.SVRCONN' was blocked from address '127.0.0.1'
because the active values of the channel matched a record configured with
USERSRC(NOACCESS). The active values of the channel were 'CLNTUSER(fresher)'.
ACTION:
Contact the systems administrator, who should examine the channel
authentication records to ensure that the correct settings have been
configured. The ALTER QMGR CHLAUTH switch is used to control whether channel
authentication records are used. The command DISPLAY CHLAUTH can be used to
query the channel authentication records. 
----- cmqxrmsa.c : 926 --------------------------------------------------------
10/20/2017 02:17:37 - Process(16340.40) User(MUSR_MQADMIN) Program(amqrmppa.exe)
                     Host(user1) Installation(Installation1)
                     VRMF(7.5.0.2) QMgr(Receiver)

AMQ9999: Channel 'SYSTEM.DEF.SVRCONN' to host 'user1 (127.0.0.1)' ended
abnormally.

EXPLANATION:
The channel program running under process ID 16340(5348) for channel
'SYSTEM.DEF.SVRCONN' ended abnormally. The host name is 'user1
(127.0.0.1)'; in some cases the host name cannot be determined and so is shown
as '????'.
ACTION:
Look at previous error messages for the channel program in the error logs to
determine the cause of the failure. Note that this message can be excluded
completely or suppressed by tuning the "ExcludeMessage" or "SuppressMessage"
attributes under the "QMErrorLog" stanza in qm.ini. Further information can be
found in the System Administration Guide. 
----- amqrmrsa.c : 898 --------------------------------------------------------
2
You should look at the QM1 queue manager's AMQERR01.LOG to see what error is logged when your client gets a 2009. Please click edit and update your question with these details. Please also provide the full version of MQ server you are using and the full version of MQ that your IBM MQ jar files are from if it is not the same.JoshMc
Did you resolve your problem?JoshMc
No not yet , I am try to use the svrconn channel as per @Roger suggestions but I could not make it. If I create a channel in that type it doesn't start so currently I am try to start that type(svrconn) of channle.Fresher
Can you confirm the version of the MQ client jar files that you are using, based on some testing I performed the get a 2009 when trying to connect the client app to a RCVR channel I had to use v6 jar files which have been out of support since Sep 30 2012 (5 years). It would be good to move to a supported version. The other thing to note is that you do not need to start a SVRCONN channel on the queue manager, as long as it is not in STOPPED status it is available for the application to connect to, you simply need to have your client app make the connection.JoshMc
Look at this answer, SYSTEM.* queues are blocked by default. "Why do I get a MQRC_NOT_AUTHORIZED error when trying to get channel information using PCF?"JoshMc

2 Answers

1
votes

channel: ch1 (receiver)

MQEnvironment.channel="ch1";

An MQ Client application cannot use a RECEIVER channel to connect to a queue manager. The application needs to connect to a SVRCONN channel.

Secondly, it is a bad idea to use lowercase names for MQ objects. MQ will automatically uppercase names that are not in quotes. So, to avoid problems, use uppercase names.

0
votes

Finally I have resolve the issue

  • By creating a svrconn channel instead of using default one SYSTEM.DEF.SVRCONN ( I have used TEST.SVRCONN )
  • And go to : channel -> Channel Authentication Records -> Delete the Block User list

By following the above method I can resolve the issue. Now I can read the messages from Java application.