WebSphere MQ与MDB中的订阅者授权

时间:2011-01-19 05:53:10

标签: java websphere ibm-mq publish-subscribe message-driven-bean

我有一个看起来像这样的MDB:

@MessageDriven(mappedName = "jms/TestJeremyTopic ", activationConfig =  {
        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
        @ActivationConfigProperty(propertyName = "subscriptionDurability", propertyValue = "Durable"),
        @ActivationConfigProperty(propertyName = "clientId", propertyValue = "TopicReaderBeanClientId"),
        @ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "TopicReaderBeanSubscriptionName")
    })
public class TopicReaderBean implements MessageListener {
    public void onMessage(Message message) {
        ...
    }
}

我在WebSphere MQ 7中设置了一个主题。使用MQ Explorer,pub和sub操作似乎都没问题。

我在WebSphere中设置了一个监听器端口。监听器端口可以成功启动。

当我部署并启动我的应用程序时,MDB无法读取任何消息。给出的例外是:

[1/19/11 10:57:06:569 EST] 00000009 MDBListenerIm W   WMSG0019E: Unable to start MDB Listener TopicReaderBean, JMSDestination jms/TestJeremyTopic :     com.ibm.msg.client.jms.DetailedJMSSecurityException: JMSWMQ0026: Failed to subscribe to topic 'TEST_JEREMY' using MQSUB. There may have been a problem creating the subscription due to it being used by another message consumer. Make sure any message consumers using this subscription are closed before trying to create a new subscription under the same name. Please see the linked exception for more information.
at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:540)
at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:236)
at com.ibm.msg.client.wmq.internal.WMQMessageConsumer.checkJmqiCallSuccess(WMQMessageConsumer.java:123)
at com.ibm.msg.client.wmq.internal.WMQConsumerShadow.initialize(WMQConsumerShadow.java:689)
at com.ibm.msg.client.wmq.internal.WMQAsyncConsumerShadow.initialize(WMQAsyncConsumerShadow.java:714)
at com.ibm.msg.client.wmq.internal.WMQConnectionBrowser.<init>(WMQConnectionBrowser.java:1223)
at com.ibm.msg.client.wmq.internal.WMQConnection.createDurableConnectionBrowser(WMQConnection.java:892)
at com.ibm.msg.client.jms.internal.JmsConnectionImpl.createDurableConnectionBrowser(JmsConnectionImpl.java:1035)
at com.ibm.msg.client.jms.internal.JmsConnectionConsumerImpl.createConnectionBrowser(JmsConnectionConsumerImpl.java:236)
at com.ibm.msg.client.jms.internal.JmsConnectionConsumerImpl.<init>(JmsConnectionConsumerImpl.java:163)
at com.ibm.msg.client.jms.internal.JmsConnectionImpl.createDurableConnectionConsumer(JmsConnectionImpl.java:502)
at com.ibm.msg.client.jms.internal.JmsXAConnectionImpl.createDurableConnectionConsumer(JmsXAConnectionImpl.java:222)
at com.ibm.mq.jms.MQConnection.createDurableConnectionConsumer(MQConnection.java:300)
at com.ibm.ejs.jms.JMSTopicConnectionHandle.createDurableConnectionConsumer(JMSTopicConnectionHandle.java:228)
at com.ibm.ejs.jms.listener.MDBListenerImpl.createResources(MDBListenerImpl.java:597)
at com.ibm.ejs.jms.listener.MDBListenerImpl.internalStart(MDBListenerImpl.java:756)
at com.ibm.ejs.jms.listener.MDBListenerImpl.restart(MDBListenerImpl.java:729)
at com.ibm.ejs.jms.listener.MDBListenerImpl.alarm(MDBListenerImpl.java:1151)
at com.ibm.ejs.util.am._Alarm.run(_Alarm.java:127)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1550)
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:223)
... 18 more

我怀疑虽然侦听器端口能够启动,但它不会主动连接,直到连接的应用程序尝试使用它。此时它已通过身份验证,但未经授权。

问:WebSphere中配置的身份验证凭据在哪里?我不知道我在认证谁。它是MDB中@ActivationConfigProperty中设置的客户端ID吗?

问:MQ Explorer中的授权设置在哪里?我没有看到任何方式向团体或个人授予酒吧或子权利。目前它被设置为允许/允许,大概是为了每个人。

1 个答案:

答案 0 :(得分:0)

身份验证和授权在操作系统级别进行控制。站在用户/组管理是关键。不要忘记在MQ Explorer中执行以下操作:QueueManager - &gt;安全 - &gt;刷新授权服务。