简体   繁体   中英

IBM MQ AMS with java clients

I have a java application, which can send and receive messages to/from queues, and I'm trying to set it up to use MQ AMS on Linux .

It is first time I'm setting MQ AMS up at all, so I'm trying the examples provided in the MQ distribution ( JmsProvider/JmsConsumer ).

Initially, I tried WebSphere MQ 7.5 , which comes with java 6 prepacked, and I could set it up, created a queue, used the attached samples to send and receive encoded messages.

However, my application is not compatible with java 6 .

I downloaded ibm jdk 8 , and tried to set that up.

It works if the messages are not encoded; however if security policy is enabled, I can send messages to the queue using WebSphere's own JmsProducer , but can't get messages using their own JmsConsumer - getting a generic MQRC_NOT_AUTHORISED error (same as the one below, except for java version). I've turned off channel authorisation , and made sure the user I'm using to create messages is specified as MCAUSER on the queue manager. My user is not in the mqm group , however, because the group doesn't exist (and my Linux distribution doesn't react to addgroup with anything other than unknown command ).

I then thought that may be the java 8 distribution I have is missing something vital to MQ , so I downloaded WebSphere MQ 8 , which contains java 7 , and tried running JmsProducer/JmsConsumer again using this new java 7 , against my old MQ 7.5 queue. The results are the same - the producer successfully produces and places the message on the queue, but the consumer falls over with not authorised .

[userName@machineName ~]$ /opt/mqm/java/jre64/jre/bin/java -showversion -classpath $CLASSPATH JmsConsumer -m QM_TEST_AMS -d TEST.Q -h hostName -p 1616 -l CHANNEL > JmsConsumer.output
java version "1.7.0"
Java(TM) SE Runtime Environment (build pxa6470_27sr2-20141026_01(SR2))
IBM J9 VM (build 2.7, JRE 1.7.0 Linux amd64-64 Compressed References 20141017_217728 (JIT enabled, AOT enabled)
J9VM - R27_Java727_SR2_20141017_1632_B217728
JIT  - tr.r13.java_20141003_74587.01
GC   - R27_Java727_SR2_20141017_1632_B217728_CMPRSS
J9CL - 20141017_217728)
JCL - 20141004_01 based on Oracle 7u71-b13

com.ibm.msg.client.jms.DetailedJMSSecurityException: JMSWMQ2008: Failed to open MQ queue 'TEST.Q'.
JMS attempted to perform an MQOPEN, but WebSphere MQ reported an error.
Use the linked exception to determine the cause of this error. Check that the specified queue and queue manager are defined correctly.
Inner exception(s):
com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED').
FAILURE

These messages can still be received if I switch to java 6 though. Could please somebody point me in the direction of what I might be missing, that prevents java 7/8 applications from receiving encoded messages from the queue, while java 6 applications continue to work as normal? Does WebSphere MQ 7.5 work with java 7/8 at all?

According to the WMQ System Requirements page for v7.5 on Linux , JTE 8.0 is not yet supported.

For what its worth, v8.0 has the same requirements as you can see here . The top-level System requirements page for all versions is here .

That said, it sounds like you have a policy or cert issue, not a JRE issue. When sending messages that are encrypted, the sender has to have the public key of the recipient's certificate. The recipient has to have the public key of the sender. Both have to have their own personal certificates, of course. The AMS policy must specify all possible recipients, even if one of them is the sender.

You haven't posted your policy settings or keystore details. Those would be required to debug this (and probably posted in a different question since this one is on JRE versions). Also, a 2035 would throw an event message. Enable Authorization events and install the MS0P SupportPac into MQ Explorer to view them in the SYSTEM.ADMIN.QMGR.EVENT queue.

适用于Java的MQ v7.5 Linus系统要求的屏幕截图

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM