使用 MDB 的 WebSphere MQ 中的订阅者授权

发布于 2024-10-12 21:04:37 字数 3907 浏览 2 评论 0原文

我有一个如下所示的 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 发布和订阅操作似乎都可以。

我已经在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 中的授权设置在哪里?我没有看到任何方法可以向团体或个人授予 pub 或 sub 权利。目前它设置为允许/允许,大概对所有人来说。

I have an MDB that looks like this:

@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) {
        ...
    }
}

I have set up a topic in WebSphere MQ 7. Using MQ Explorer both pub and sub operations seem to be OK.

I have set up a Listener Port in WebSphere. The Listener Port can be started successfully.

When I deploy and start my app the MDB fails to read any message. The exception given is:

[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

I suspect that whilst the listener port is able to start, it doesn't actively connect until an attached application attempts to use it. At this time it is authenticated, but not authorised.

Q: Where are the authentication credentials configured in WebSphere? I have no idea who I am authenticating as. Is it the client ID set in the @ActivationConfigProperty in the MDB?

Q: Where are the authorisation settings in MQ Explorer? I don't see any way to grant pub or sub rights to groups or individuals. Currently it is set to allow/allow, presumably for everyone.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

对你而言 2024-10-19 21:04:37

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

The authentication and authorisation is controlled at the OS level. Stand user/group management is key here. Don't forget to do the following in MQ Explorer: QueueManager -> Security -> Refresh Authorization Service.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文