Testing IBM MQ on IBM i with Java
How you test IBM MQ with Java using the MQIVP sample program.
Testing IBM MQ base Java
Carry out the following procedure:- Verify that the queue manager is started, and that the state of the queue manager is ACTIVE, by issuing the following command:
WRKMQM MQMNAME(QMGRNAME)
- Verify that the JAVA.CHANNEL server connection channel has been created by issuing the following command:
WRKMQMCHL CHLNAME(JAVA.CHANNEL) CHLTYPE(*SVRCN) MQMNAME(QMGRNAME)
- If the JAVA.CHANNEL does not exist, issue the following command:
CRTMQMCHL CHLNAME(JAVA.CHANNEL) CHLTYPE(*SVRCN) MQMNAME(QMGRNAME)
- If the JAVA.CHANNEL does not exist, issue the following command:
- Verify the queue manager listener is running for port 1414 or whichever port we are using, by issuing the WRKMQMLSR command.
- If no listener has been started for the queue manager, issue the following command:
STRMQMLSR PORT(xxxx) MQMNAME(QMGRNAME)
- If no listener has been started for the queue manager, issue the following command:
Running the MQIVP sample test program
- Start the qshell, from the command line by issuing the command STRQSH
- Verify that the correct CLASSPATH is set by issuing the export command, and then issue the cd command as follows:
cd /qibm/proddata/mqm/java/samples/wmqjava/samples
- Run the java program by issuing the following command:
java MQIVP
We can press the ENTER key when prompted for:
- Type of connection
- IP address
- Queue manager name
to use the default values. This verifies the product bindings, which can be found in the QMQMJAVA library. You receive output similar to the following example. Note that the copyright statement depends upon the version of the product that we are using.
> java MQIVP MQSeries for Java Installation Verification Program 5724-H72 (C) Copyright IBM Corp. 2011, 2020. All Rights Reserved. =========================================================== Please enter the IP address of the MQ server :> Please enter the queue manager name :> Attaching Java program to QIBM/ProdData/mqm/java/lib/connector.JAR. Success: Connected to queue manager. Success: Opened SYSTEM.DEFAULT.LOCAL.QUEUE Success: Put a message to SYSTEM.DEFAULT.LOCAL.QUEUE Success: Got a message from SYSTEM.DEFAULT.LOCAL.QUEUE Success: Closed SYSTEM.DEFAULT.LOCAL.QUEUE Success: Disconnected from queue manager Tests complete - SUCCESS: This MQ Transport is functioning correctly. Press Enter to continue ...> $
Testing IBM MQ Java client connection
We must specify the:- Connection type
- IP address
- Port
- Server connection channel
- Queue manager
You receive output similar to the following example. Note that the copyright statement depends upon the version of the product that we are using.
> java MQIVP MQSeries for Java Installation Verification Program 5724-H72 (C) Copyright IBM Corp. 2011, 2020. All Rights Reserved. =========================================================== Please enter the IP address of the MQ server :> x.xx.xx.xx Please enter the port to connect to : (1414)> 1470 Please enter the server connection channel name :> JAVA.CHANNEL Please enter the queue manager name :> KAREN01 Success: Connected to queue manager. Success: Opened SYSTEM.DEFAULT.LOCAL.QUEUE Success: Put a message to SYSTEM.DEFAULT.LOCAL.QUEUE Success: Got a message from SYSTEM.DEFAULT.LOCAL.QUEUE Success: Closed SYSTEM.DEFAULT.LOCAL.QUEUE Success: Disconnected from queue manager Tests complete - SUCCESS: This MQ Transport is functioning correctly. Press Enter to continue ...> $Parent topic: Set up IBM MQ on IBM i with Java and JMS