Reputation: 455
I am having a ongoing problem trying to create a topic publisher from seemingly simple java code. My WMQ is administered separately in the company so I have no direct control of it.
I try to connect to the topic by creating a TopicConnection
, then a TopicSession
and then a TopicPublisher
, using fairly standard Java code albeit over SSL so setting some additional system props. However I have the same problem with or without SSL I am fairly certain.
On the line
this.topicPublisher = this.topicPublisherSession.createPublisher(this.topic);
a WMQ exception is raised as follows
Caused by: com.ibm.mq.MQException: JMSCMQ0001: WebSphere MQ call failed with compcode '2' ('MQCC_FAILED') reason '2035' ('MQRC_NOT_AUTHORIZED').
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:209)
The WMQ administrator can provide a "fix" for me by granting auths on the SYSTEM.BASE.TOPIC
. However this is disallowed by company risk policy.
I have been asked why do I need access to the base topic, but of course I do not need that access. I just simply need to publish to my topic.
Any WMQ experts got any other ideas please? Thanks so much.
Upvotes: 4
Views: 841
Reputation: 15273
MQ maintains a Topic Tree for managing publish/subscribe. By default access for non-admin users to the topic tree is not allowed. The root of the topic tree resolves attributes from SYSTEM.BASE.TOPIC.
When an application attempts to create a publisher with a topic, MQ makes authority checks using the topic string specified. MQ searches the topic tree for a node that matches the given topic string. If a match is found, authority to publish or subscribe is determined. If the user has enough authority, then create publisher call will succeed. If no nodes match, then MQ goes up to the root of the topic tree to determine authority.
In your case, your application has specified a topic string that does not match any of the nodes defined in the topic tree. MQ attempted to determine authority at the root. Since you do not have the publish authority, the call is failing with 2035 reason code.
So what can be done? Instead of providing access to SYSTEM.BASE.TOPIC, ask your administrator create a topic with topic string your application is using and provide you publish
authority.
Upvotes: 5